firebase-tools-with-isolate 13.15.0-0 → 13.26.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 (235) hide show
  1. package/lib/api.js +3 -1
  2. package/lib/apiv2.js +10 -3
  3. package/lib/appdistribution/client.js +62 -8
  4. package/lib/appdistribution/distribution.js +1 -1
  5. package/lib/apphosting/backend.js +299 -0
  6. package/lib/apphosting/config.js +31 -8
  7. package/lib/apphosting/githubConnections.js +70 -22
  8. package/lib/apphosting/index.js +3 -312
  9. package/lib/apphosting/rollout.js +138 -0
  10. package/lib/apphosting/secrets/index.js +70 -5
  11. package/lib/apphosting/utils.js +41 -0
  12. package/lib/apphosting/yaml.js +82 -0
  13. package/lib/archiveDirectory.js +1 -1
  14. package/lib/auth.js +31 -5
  15. package/lib/bin/firebase.js +2 -2
  16. package/lib/command.js +18 -4
  17. package/lib/commands/appdistribution-distribute.js +4 -4
  18. package/lib/commands/{appdistribution-group-create.js → appdistribution-groups-create.js} +2 -1
  19. package/lib/commands/{appdistribution-group-delete.js → appdistribution-groups-delete.js} +3 -2
  20. package/lib/commands/appdistribution-groups-list.js +55 -0
  21. package/lib/commands/appdistribution-testers-list.js +52 -0
  22. package/lib/commands/appdistribution-testers-remove.js +1 -1
  23. package/lib/commands/apphosting-backends-create.js +4 -4
  24. package/lib/commands/apphosting-backends-delete.js +7 -15
  25. package/lib/commands/apphosting-backends-get.js +1 -1
  26. package/lib/commands/apphosting-config-export.js +51 -0
  27. package/lib/commands/apphosting-repos-create.js +23 -0
  28. package/lib/commands/apphosting-rollouts-create.js +14 -15
  29. package/lib/commands/apphosting-secrets-grantaccess.js +2 -2
  30. package/lib/commands/database-import.js +4 -2
  31. package/lib/commands/database-push.js +4 -2
  32. package/lib/commands/database-set.js +4 -2
  33. package/lib/commands/database-settings-get.js +1 -1
  34. package/lib/commands/database-settings-set.js +1 -1
  35. package/lib/commands/dataconnect-sdk-generate.js +4 -1
  36. package/lib/commands/dataconnect-services-list.js +4 -3
  37. package/lib/commands/dataconnect-sql-diff.js +1 -1
  38. package/lib/commands/dataconnect-sql-grant.js +37 -0
  39. package/lib/commands/dataconnect-sql-migrate.js +1 -1
  40. package/lib/commands/dataconnect-sql-shell.js +115 -0
  41. package/lib/commands/deploy.js +5 -1
  42. package/lib/commands/emulators-start.js +4 -1
  43. package/lib/commands/ext-dev-init.js +2 -2
  44. package/lib/commands/ext-dev-list.js +1 -1
  45. package/lib/commands/ext-dev-register.js +2 -2
  46. package/lib/commands/ext-dev-upload.js +2 -2
  47. package/lib/commands/ext-dev-usage.js +2 -2
  48. package/lib/commands/ext-info.js +3 -1
  49. package/lib/commands/ext-install.js +2 -2
  50. package/lib/commands/ext-sdk-install.js +88 -0
  51. package/lib/commands/ext.js +1 -0
  52. package/lib/commands/firestore-databases-restore.js +39 -1
  53. package/lib/commands/functions-secrets-access.js +2 -4
  54. package/lib/commands/index.js +15 -2
  55. package/lib/commands/init.js +25 -15
  56. package/lib/commands/setup-emulators-dataconnect.js +0 -13
  57. package/lib/commands/use.js +1 -1
  58. package/lib/config.js +14 -4
  59. package/lib/crashlytics/buildToolsJarHelper.js +2 -2
  60. package/lib/dataconnect/client.js +3 -2
  61. package/lib/dataconnect/dataplaneClient.js +12 -9
  62. package/lib/dataconnect/ensureApis.js +6 -1
  63. package/lib/dataconnect/fileUtils.js +29 -12
  64. package/lib/dataconnect/freeTrial.js +45 -9
  65. package/lib/dataconnect/load.js +3 -1
  66. package/lib/dataconnect/provisionCloudSql.js +41 -24
  67. package/lib/dataconnect/schemaMigration.js +215 -74
  68. package/lib/dataconnect/types.js +4 -1
  69. package/lib/dataconnect/webhook.js +32 -0
  70. package/lib/deploy/dataconnect/deploy.js +18 -15
  71. package/lib/deploy/dataconnect/prepare.js +41 -0
  72. package/lib/deploy/dataconnect/release.js +16 -7
  73. package/lib/deploy/extensions/deploy.js +3 -1
  74. package/lib/deploy/extensions/deploymentSummary.js +7 -3
  75. package/lib/deploy/extensions/planner.js +95 -5
  76. package/lib/deploy/extensions/prepare.js +89 -42
  77. package/lib/deploy/extensions/release.js +17 -10
  78. package/lib/deploy/extensions/tasks.js +32 -21
  79. package/lib/deploy/firestore/prepare.js +9 -0
  80. package/lib/deploy/firestore/release.js +3 -6
  81. package/lib/deploy/functions/build.js +5 -5
  82. package/lib/deploy/functions/checkIam.js +7 -2
  83. package/lib/deploy/functions/deploy.js +12 -12
  84. package/lib/deploy/functions/ensure.js +11 -3
  85. package/lib/deploy/functions/params.js +5 -3
  86. package/lib/deploy/functions/prepare.js +18 -3
  87. package/lib/deploy/functions/release/index.js +4 -0
  88. package/lib/deploy/functions/release/planner.js +2 -1
  89. package/lib/deploy/functions/runtimes/discovery/index.js +6 -2
  90. package/lib/deploy/functions/runtimes/discovery/parsing.js +1 -1
  91. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +46 -0
  92. package/lib/deploy/functions/runtimes/node/index.js +5 -0
  93. package/lib/deploy/functions/services/auth.js +34 -3
  94. package/lib/deploy/functions/services/index.js +2 -0
  95. package/lib/deploy/index.js +8 -5
  96. package/lib/deploy/lifecycleHooks.js +2 -1
  97. package/lib/emulator/apphosting/config.js +27 -0
  98. package/lib/emulator/apphosting/index.js +38 -0
  99. package/lib/emulator/apphosting/serve.js +50 -0
  100. package/lib/emulator/apphosting/utils.js +18 -0
  101. package/lib/emulator/auth/handlers.js +27 -0
  102. package/lib/emulator/auth/operations.js +41 -2
  103. package/lib/emulator/auth/state.js +2 -1
  104. package/lib/emulator/commandUtils.js +8 -3
  105. package/lib/emulator/constants.js +11 -1
  106. package/lib/emulator/controller.js +59 -6
  107. package/lib/emulator/dataconnect/pg-gateway/auth/base-auth-flow.js +11 -0
  108. package/lib/emulator/dataconnect/pg-gateway/auth/cert.js +58 -0
  109. package/lib/emulator/dataconnect/pg-gateway/auth/index.js +22 -0
  110. package/lib/emulator/dataconnect/pg-gateway/auth/md5.js +124 -0
  111. package/lib/emulator/dataconnect/pg-gateway/auth/password.js +54 -0
  112. package/lib/emulator/dataconnect/pg-gateway/auth/sasl/sasl-mechanism.js +34 -0
  113. package/lib/emulator/dataconnect/pg-gateway/auth/sasl/scram-sha-256.js +270 -0
  114. package/lib/emulator/dataconnect/pg-gateway/auth/trust.js +2 -0
  115. package/lib/emulator/dataconnect/pg-gateway/backend-error.js +75 -0
  116. package/lib/emulator/dataconnect/pg-gateway/buffer-reader.js +54 -0
  117. package/lib/emulator/dataconnect/pg-gateway/buffer-writer.js +79 -0
  118. package/lib/emulator/dataconnect/pg-gateway/connection.js +315 -0
  119. package/lib/emulator/dataconnect/pg-gateway/connection.types.js +8 -0
  120. package/lib/emulator/dataconnect/pg-gateway/crypto.js +40 -0
  121. package/lib/emulator/dataconnect/pg-gateway/duplex.js +53 -0
  122. package/lib/emulator/dataconnect/pg-gateway/index.js +27 -0
  123. package/lib/emulator/dataconnect/pg-gateway/message-buffer.js +82 -0
  124. package/lib/emulator/dataconnect/pg-gateway/message-codes.js +52 -0
  125. package/lib/emulator/dataconnect/pg-gateway/platforms/node/index.js +16 -0
  126. package/lib/emulator/dataconnect/pg-gateway/polyfills/readable-stream-async-iterator.js +35 -0
  127. package/lib/emulator/dataconnect/pg-gateway/utils.js +40 -0
  128. package/lib/emulator/dataconnect/pgliteServer.js +95 -0
  129. package/lib/emulator/dataconnectEmulator.js +58 -75
  130. package/lib/emulator/dataconnectToolkitController.js +44 -0
  131. package/lib/emulator/downloadableEmulators.js +30 -19
  132. package/lib/emulator/emulatorLogger.js +3 -0
  133. package/lib/emulator/env.js +3 -0
  134. package/lib/emulator/eventarcEmulator.js +1 -1
  135. package/lib/emulator/extensionsEmulator.js +38 -6
  136. package/lib/emulator/functionsEmulator.js +115 -42
  137. package/lib/emulator/functionsEmulatorShared.js +18 -1
  138. package/lib/emulator/functionsRuntimeWorker.js +2 -1
  139. package/lib/emulator/hub.js +13 -9
  140. package/lib/emulator/hubExport.js +10 -3
  141. package/lib/emulator/loggingEmulator.js +2 -2
  142. package/lib/emulator/portUtils.js +11 -11
  143. package/lib/emulator/registry.js +2 -0
  144. package/lib/emulator/storage/persistence.js +2 -2
  145. package/lib/emulator/storage/rules/runtime.js +1 -1
  146. package/lib/emulator/taskQueue.js +348 -0
  147. package/lib/emulator/tasksEmulator.js +240 -0
  148. package/lib/emulator/types.js +6 -0
  149. package/lib/emulator/ui.js +51 -25
  150. package/lib/error.js +31 -1
  151. package/lib/experiments.js +5 -0
  152. package/lib/extensions/askUserForEventsConfig.js +18 -8
  153. package/lib/extensions/askUserForParam.js +2 -1
  154. package/lib/extensions/displayExtensionInfo.js +5 -5
  155. package/lib/extensions/emulator/triggerHelper.js +1 -1
  156. package/lib/extensions/extensionsApi.js +15 -11
  157. package/lib/extensions/extensionsHelper.js +39 -8
  158. package/lib/extensions/localHelper.js +32 -1
  159. package/lib/extensions/refs.js +26 -11
  160. package/lib/extensions/runtimes/common.js +215 -0
  161. package/lib/extensions/runtimes/node.js +401 -0
  162. package/lib/extensions/types.js +67 -1
  163. package/lib/extensions/warnings.js +5 -2
  164. package/lib/firestore/api.js +2 -1
  165. package/lib/firestore/checkDatabaseType.js +10 -3
  166. package/lib/firestore/delete.js +11 -0
  167. package/lib/firestore/options.js +7 -0
  168. package/lib/frameworks/angular/index.js +15 -3
  169. package/lib/frameworks/constants.js +2 -2
  170. package/lib/frameworks/flutter/index.js +6 -6
  171. package/lib/frameworks/flutter/utils.js +34 -1
  172. package/lib/frameworks/next/constants.js +1 -1
  173. package/lib/frameworks/next/index.js +45 -17
  174. package/lib/frameworks/next/utils.js +57 -4
  175. package/lib/frameworks/vite/index.js +2 -2
  176. package/lib/fsutils.js +13 -1
  177. package/lib/functions/constants.js +4 -0
  178. package/lib/functions/events/v1.js +9 -2
  179. package/lib/gcp/apphosting.js +1 -1
  180. package/lib/gcp/cloudmonitoring.js +3 -3
  181. package/lib/gcp/cloudsql/cloudsqladmin.js +32 -20
  182. package/lib/gcp/cloudsql/connect.js +49 -37
  183. package/lib/gcp/cloudsql/interactive.js +49 -0
  184. package/lib/gcp/cloudsql/permissions.js +165 -0
  185. package/lib/gcp/devConnect.js +38 -1
  186. package/lib/gcp/firestore.js +5 -1
  187. package/lib/gcp/secretManager.js +12 -5
  188. package/lib/getProjectNumber.js +1 -1
  189. package/lib/init/features/apphosting.js +15 -0
  190. package/lib/init/features/dataconnect/index.js +166 -121
  191. package/lib/init/features/dataconnect/sdk.js +90 -81
  192. package/lib/init/features/emulators.js +2 -15
  193. package/lib/init/features/firestore/index.js +20 -1
  194. package/lib/init/features/firestore/indexes.js +4 -4
  195. package/lib/init/features/genkit/index.js +444 -0
  196. package/lib/init/features/hosting/index.js +2 -2
  197. package/lib/init/features/index.js +1 -1
  198. package/lib/init/features/project.js +6 -6
  199. package/lib/init/features/storage.js +0 -2
  200. package/lib/init/index.js +1 -0
  201. package/lib/init/spawn.js +23 -2
  202. package/lib/logger.js +2 -2
  203. package/lib/management/projects.js +24 -4
  204. package/lib/projectUtils.js +1 -1
  205. package/lib/prompt.js +22 -1
  206. package/lib/rc.js +1 -8
  207. package/lib/requireAuth.js +19 -5
  208. package/lib/requireDatabaseInstance.js +1 -1
  209. package/lib/requirePermissions.js +1 -1
  210. package/lib/responseToError.js +5 -2
  211. package/lib/rulesDeploy.js +1 -1
  212. package/lib/templates.js +2 -2
  213. package/lib/utils.js +16 -11
  214. package/lib/vsCodeUtils.js +8 -0
  215. package/package.json +8 -7
  216. package/schema/connector-yaml.json +57 -17
  217. package/schema/firebase-config.json +36 -0
  218. package/templates/extensions/javascript/package.lint.json +2 -2
  219. package/templates/extensions/javascript/package.nolint.json +2 -2
  220. package/templates/extensions/typescript/package.lint.json +2 -2
  221. package/templates/extensions/typescript/package.nolint.json +2 -2
  222. package/templates/genkit/firebase.0.9.0.template +57 -0
  223. package/templates/init/apphosting/apphosting.yaml +23 -0
  224. package/templates/init/dataconnect/connector.yaml +4 -3
  225. package/templates/init/dataconnect/dataconnect-fdccompatiblemode.yaml +12 -0
  226. package/templates/init/dataconnect/dataconnect.yaml +6 -6
  227. package/templates/init/dataconnect/mutations.gql +44 -29
  228. package/templates/init/dataconnect/queries.gql +65 -38
  229. package/templates/init/dataconnect/schema.gql +38 -21
  230. package/templates/init/functions/javascript/package.lint.json +2 -2
  231. package/templates/init/functions/javascript/package.nolint.json +2 -2
  232. package/templates/init/functions/typescript/package.lint.json +2 -2
  233. package/templates/init/functions/typescript/package.nolint.json +2 -2
  234. package/lib/ensureCloudResourceLocation.js +0 -12
  235. package/lib/init/features/genkit.js +0 -53
@@ -11,9 +11,19 @@ const build_1 = require("../../dataconnect/build");
11
11
  const ensureApis_1 = require("../../dataconnect/ensureApis");
12
12
  const requireTosAcceptance_1 = require("../../requireTosAcceptance");
13
13
  const firedata_1 = require("../../gcp/firedata");
14
+ const provisionCloudSql_1 = require("../../dataconnect/provisionCloudSql");
15
+ const cloudbilling_1 = require("../../gcp/cloudbilling");
16
+ const names_1 = require("../../dataconnect/names");
14
17
  const error_1 = require("../../error");
18
+ const types_1 = require("../../dataconnect/types");
19
+ const schemaMigration_1 = require("../../dataconnect/schemaMigration");
20
+ const node_path_1 = require("node:path");
21
+ const freeTrial_1 = require("../../dataconnect/freeTrial");
15
22
  async function default_1(context, options) {
16
23
  const projectId = (0, projectUtils_1.needProjectId)(options);
24
+ if (!(await (0, cloudbilling_1.checkBillingEnabled)(projectId))) {
25
+ throw new error_1.FirebaseError((0, freeTrial_1.upgradeInstructions)(projectId));
26
+ }
17
27
  await (0, ensureApis_1.ensureApis)(projectId);
18
28
  await (0, requireTosAcceptance_1.requireTosAcceptance)(firedata_1.DATA_CONNECT_TOS_ID)(options);
19
29
  const serviceCfgs = (0, fileUtils_1.readFirebaseJson)(options.config);
@@ -41,6 +51,37 @@ async function default_1(context, options) {
41
51
  filters,
42
52
  };
43
53
  utils.logLabeledBullet("dataconnect", `Successfully prepared schema and connectors`);
54
+ if (options.dryRun) {
55
+ for (const si of serviceInfos) {
56
+ await (0, schemaMigration_1.diffSchema)(si.schema, si.dataConnectYaml.schema.datasource.postgresql?.schemaValidation);
57
+ }
58
+ utils.logLabeledBullet("dataconnect", "Checking for CloudSQL resources...");
59
+ await Promise.all(serviceInfos
60
+ .filter((si) => {
61
+ return !filters || filters?.some((f) => si.dataConnectYaml.serviceId === f.serviceId);
62
+ })
63
+ .map(async (s) => {
64
+ const postgresDatasource = s.schema.datasources.find((d) => d.postgresql);
65
+ if (postgresDatasource) {
66
+ const instanceId = postgresDatasource.postgresql?.cloudSql.instance.split("/").pop();
67
+ const databaseId = postgresDatasource.postgresql?.database;
68
+ if (!instanceId || !databaseId) {
69
+ return Promise.resolve();
70
+ }
71
+ const enableGoogleMlIntegration = (0, types_1.requiresVector)(s.deploymentMetadata);
72
+ return (0, provisionCloudSql_1.provisionCloudSql)({
73
+ projectId,
74
+ locationId: (0, names_1.parseServiceName)(s.serviceName).location,
75
+ instanceId,
76
+ databaseId,
77
+ configYamlPath: (0, node_path_1.join)(s.sourceDirectory, "dataconnect.yaml"),
78
+ enableGoogleMlIntegration,
79
+ waitForCreation: true,
80
+ dryRun: options.dryRun,
81
+ });
82
+ }
83
+ }));
84
+ }
44
85
  logger_1.logger.debug(JSON.stringify(context.dataconnect, null, 2));
45
86
  return;
46
87
  }
@@ -4,7 +4,9 @@ const utils = require("../../utils");
4
4
  const client_1 = require("../../dataconnect/client");
5
5
  const prompts_1 = require("../../dataconnect/prompts");
6
6
  const schemaMigration_1 = require("../../dataconnect/schemaMigration");
7
+ const projectUtils_1 = require("../../projectUtils");
7
8
  async function default_1(context, options) {
9
+ const project = (0, projectUtils_1.needProjectId)(options);
8
10
  const serviceInfos = context.dataconnect.serviceInfos;
9
11
  const filters = context.dataconnect.filters;
10
12
  const wantSchemas = serviceInfos
@@ -14,17 +16,21 @@ async function default_1(context, options) {
14
16
  return f.serviceId === si.dataConnectYaml.serviceId && (f.schemaOnly || f.fullService);
15
17
  }));
16
18
  })
17
- .map((s) => s.schema);
19
+ .map((s) => ({
20
+ schema: s.schema,
21
+ validationMode: s.dataConnectYaml.schema.datasource.postgresql?.schemaValidation,
22
+ }));
18
23
  if (wantSchemas.length) {
19
- utils.logLabeledBullet("dataconnect", "Releasing Data Connect schemas...");
24
+ utils.logLabeledBullet("dataconnect", "Deploying Data Connect schemas...");
20
25
  for (const s of wantSchemas) {
21
26
  await (0, schemaMigration_1.migrateSchema)({
22
27
  options,
23
- schema: s,
28
+ schema: s.schema,
24
29
  validateOnly: false,
30
+ schemaValidation: s.validationMode,
25
31
  });
26
32
  }
27
- utils.logLabeledBullet("dataconnect", "Schemas released.");
33
+ utils.logLabeledBullet("dataconnect", "Schemas deployed.");
28
34
  }
29
35
  let wantConnectors = [];
30
36
  wantConnectors = wantConnectors.concat(...serviceInfos.map((si) => si.connectorInfo
@@ -41,7 +47,7 @@ async function default_1(context, options) {
41
47
  ? []
42
48
  : haveConnectors.filter((h) => !wantConnectors.some((w) => w.name === h.name));
43
49
  if (wantConnectors.length) {
44
- utils.logLabeledBullet("dataconnect", "Releasing connectors...");
50
+ utils.logLabeledBullet("dataconnect", "Deploying connectors...");
45
51
  await Promise.all(wantConnectors.map(async (c) => {
46
52
  await (0, client_1.upsertConnector)(c);
47
53
  utils.logLabeledSuccess("dataconnect", `Deployed connector ${c.name}`);
@@ -49,9 +55,12 @@ async function default_1(context, options) {
49
55
  for (const c of connectorsToDelete) {
50
56
  await (0, prompts_1.promptDeleteConnector)(options, c.name);
51
57
  }
52
- utils.logLabeledBullet("dataconnect", "Connectors released.");
58
+ utils.logLabeledBullet("dataconnect", "Connectors deployed.");
53
59
  }
54
- utils.logLabeledSuccess("dataconnect", "Deploy complete!");
60
+ else {
61
+ utils.logLabeledBullet("dataconnect", "No connectors to deploy.");
62
+ }
63
+ utils.logLabeledSuccess("dataconnect", `Deployment complete! View your deployed schema and connectors at ${utils.consoleUrl(project, "/dataconnect")}`);
55
64
  return;
56
65
  }
57
66
  exports.default = default_1;
@@ -17,7 +17,9 @@ async function deploy(context, options, payload) {
17
17
  ...(payload.instancesToUpdate ?? []),
18
18
  ...(payload.instancesToConfigure ?? []),
19
19
  ]);
20
- await (0, secrets_1.handleSecretParams)(payload, context.have, options.nonInteractive);
20
+ if (context.have) {
21
+ await (0, secrets_1.handleSecretParams)(payload, context.have, options.nonInteractive);
22
+ }
21
23
  const errorHandler = new errors_1.ErrorHandler();
22
24
  const validationQueue = new queue_1.default({
23
25
  retries: 5,
@@ -10,7 +10,7 @@ const humanReadableUpdate = (from, to) => {
10
10
  to.ref &&
11
11
  from.ref.publisherId === to.ref.publisherId &&
12
12
  from.ref.extensionId === to.ref.extensionId) {
13
- return `\t${clc.bold(from.instanceId)} (${refs.toExtensionVersionRef(from.ref)} => ${to.ref?.version})`;
13
+ return `\t${clc.bold(from.instanceId)} (${refs.toExtensionVersionRef(from.ref)} => ${to.ref?.version || ""})`;
14
14
  }
15
15
  else {
16
16
  const fromRef = from.ref
@@ -31,6 +31,9 @@ function updatesSummary(toUpdate, have) {
31
31
  const instancesToUpdate = toUpdate
32
32
  .map((to) => {
33
33
  const from = have.find((exists) => exists.instanceId === to.instanceId);
34
+ if (!from) {
35
+ return "";
36
+ }
34
37
  return humanReadableUpdate(from, to);
35
38
  })
36
39
  .join("\n");
@@ -46,10 +49,11 @@ function configuresSummary(toConfigure) {
46
49
  : "";
47
50
  }
48
51
  exports.configuresSummary = configuresSummary;
49
- function deletesSummary(toDelete) {
52
+ function deletesSummary(toDelete, isDynamic) {
50
53
  const instancesToDelete = toDelete.map((s) => `\t${(0, exports.humanReadable)(s)}`).join("\n");
54
+ const definedLocation = isDynamic ? "your local source code" : "'firebase.json'";
51
55
  return toDelete.length
52
- ? `The following extension instances are not listed in 'firebase.json':\n${instancesToDelete}\n`
56
+ ? `The following extension instances are found in your project but do not exist in ${definedLocation}:\n${instancesToDelete}\n`
53
57
  : "";
54
58
  }
55
59
  exports.deletesSummary = deletesSummary;
@@ -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.haveDynamic = 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) {
@@ -45,20 +46,57 @@ async function getExtensionSpec(i) {
45
46
  throw new error_1.FirebaseError("InstanceSpec had no ref or localPath, unable to get extensionSpec");
46
47
  }
47
48
  }
49
+ if (!i.extensionSpec) {
50
+ throw new error_1.FirebaseError("Internal error getting extension");
51
+ }
48
52
  return i.extensionSpec;
49
53
  }
50
54
  exports.getExtensionSpec = getExtensionSpec;
55
+ async function haveDynamic(projectId) {
56
+ return (await extensionsApi.listInstances(projectId))
57
+ .filter((i) => i.labels?.createdBy === "SDK")
58
+ .map((i) => {
59
+ const instanceId = i.name.split("/").pop();
60
+ if (!instanceId) {
61
+ throw new error_1.FirebaseError(`Internal error getting instanceId from ${i.name}`);
62
+ }
63
+ const dep = {
64
+ instanceId,
65
+ params: i.config.params,
66
+ systemParams: i.config.systemParams ?? {},
67
+ allowedEventTypes: i.config.allowedEventTypes,
68
+ eventarcChannel: i.config.eventarcChannel,
69
+ etag: i.etag,
70
+ labels: i.labels,
71
+ };
72
+ if (i.config.extensionRef) {
73
+ const ref = refs.parse(i.config.extensionRef);
74
+ dep.ref = ref;
75
+ dep.ref.version = i.config.extensionVersion;
76
+ }
77
+ return dep;
78
+ });
79
+ }
80
+ exports.haveDynamic = haveDynamic;
51
81
  async function have(projectId) {
52
- const instances = await extensionsApi.listInstances(projectId);
53
- return instances.map((i) => {
82
+ return (await extensionsApi.listInstances(projectId))
83
+ .filter((i) => !(i.labels?.createdBy === "SDK"))
84
+ .map((i) => {
85
+ const instanceId = i.name.split("/").pop();
86
+ if (!instanceId) {
87
+ throw new error_1.FirebaseError(`Internal error getting instanceId from ${i.name}`);
88
+ }
54
89
  const dep = {
55
- instanceId: i.name.split("/").pop(),
90
+ instanceId,
56
91
  params: i.config.params,
57
92
  systemParams: i.config.systemParams ?? {},
58
93
  allowedEventTypes: i.config.allowedEventTypes,
59
94
  eventarcChannel: i.config.eventarcChannel,
60
95
  etag: i.etag,
61
96
  };
97
+ if (i.labels) {
98
+ dep.labels = i.labels;
99
+ }
62
100
  if (i.config.extensionRef) {
63
101
  const ref = refs.parse(i.config.extensionRef);
64
102
  dep.ref = ref;
@@ -68,9 +106,61 @@ async function have(projectId) {
68
106
  });
69
107
  }
70
108
  exports.have = have;
109
+ async function wantDynamic(args) {
110
+ const instanceSpecs = [];
111
+ const errors = [];
112
+ if (!args.extensions) {
113
+ return [];
114
+ }
115
+ for (const [instanceId, ext] of Object.entries(args.extensions)) {
116
+ const autoPopulatedParams = await (0, extensionsHelper_1.getFirebaseProjectParams)(args.projectId, args.emulatorMode);
117
+ const subbedParams = (0, extensionsHelper_1.substituteParams)(ext.params, autoPopulatedParams);
118
+ const eventarcChannel = ext.params["_EVENT_ARC_REGION"]
119
+ ? (0, askUserForEventsConfig_1.getEventArcChannel)(args.projectId, ext.params["_EVENT_ARC_REGION"])
120
+ : undefined;
121
+ delete subbedParams["_EVENT_ARC_REGION"];
122
+ const subbedSecretParams = await (0, extensionsHelper_1.substituteSecretParams)(args.projectNumber, subbedParams);
123
+ const [systemParams, params] = (0, functional_1.partitionRecord)(subbedSecretParams, paramHelper_1.isSystemParam);
124
+ const allowedEventTypes = ext.events.length ? ext.events : undefined;
125
+ if (allowedEventTypes && !eventarcChannel) {
126
+ errors.push(new error_1.FirebaseError("EventArcRegion must be specified if event handlers are defined"));
127
+ }
128
+ if (ext.localPath) {
129
+ instanceSpecs.push({
130
+ instanceId,
131
+ localPath: ext.localPath,
132
+ params,
133
+ systemParams,
134
+ allowedEventTypes,
135
+ eventarcChannel,
136
+ labels: ext.labels,
137
+ });
138
+ }
139
+ else if (ext.ref) {
140
+ instanceSpecs.push({
141
+ instanceId,
142
+ ref: refs.parse(ext.ref),
143
+ params,
144
+ systemParams,
145
+ allowedEventTypes,
146
+ eventarcChannel,
147
+ labels: ext.labels,
148
+ });
149
+ }
150
+ }
151
+ if (errors.length) {
152
+ const messages = errors.map((err) => `- ${err.message}`).join("\n");
153
+ throw new error_1.FirebaseError(`Errors while reading 'extensions' in app code\n${messages}`);
154
+ }
155
+ return instanceSpecs;
156
+ }
157
+ exports.wantDynamic = wantDynamic;
71
158
  async function want(args) {
72
159
  const instanceSpecs = [];
73
160
  const errors = [];
161
+ if (!args.extensions) {
162
+ return [];
163
+ }
74
164
  for (const e of Object.entries(args.extensions)) {
75
165
  try {
76
166
  const instanceId = e[0];
@@ -115,7 +205,7 @@ async function want(args) {
115
205
  }
116
206
  }
117
207
  catch (err) {
118
- logger_1.logger.debug(`Got error reading extensions entry ${e}: ${err}`);
208
+ logger_1.logger.debug(`Got error reading extensions entry ${e[0]} (${e[1]}): ${(0, error_1.getErrMsg)(err)}`);
119
209
  errors.push(err);
120
210
  }
121
211
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prepare = void 0;
3
+ exports.prepare = exports.prepareDynamicExtensions = void 0;
4
4
  const planner = require("./planner");
5
5
  const deploymentSummary = require("./deploymentSummary");
6
6
  const prompt = require("../../prompt");
@@ -16,31 +16,36 @@ const warnings_1 = require("../../extensions/warnings");
16
16
  const etags_1 = require("../../extensions/etags");
17
17
  const v2FunctionHelper_1 = require("./v2FunctionHelper");
18
18
  const tos_1 = require("../../extensions/tos");
19
- async function prepare(context, options, payload) {
20
- context.extensionsStartTime = Date.now();
19
+ const common_1 = require("../../extensions/runtimes/common");
20
+ const functionsDeployHelper_1 = require("../functions/functionsDeployHelper");
21
+ const matchesInstanceId = (dep) => (test) => {
22
+ return dep.instanceId === test.instanceId;
23
+ };
24
+ const isUpdate = (dep) => (test) => {
25
+ return dep.instanceId === test.instanceId && !refs.equal(dep.ref, test.ref);
26
+ };
27
+ const isConfigure = (dep) => (test) => {
28
+ return dep.instanceId === test.instanceId && refs.equal(dep.ref, test.ref);
29
+ };
30
+ async function prepareHelper(context, options, payload, wantExtensions, haveExtensions, isDynamic) {
21
31
  const projectId = (0, projectUtils_1.needProjectId)(options);
22
- const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
23
- const aliases = (0, projectUtils_1.getAliases)(options, projectId);
24
- await (0, extensionsHelper_1.ensureExtensionsApiEnabled)(options);
25
- await (0, requirePermissions_1.requirePermissions)(options, ["firebaseextensions.instances.list"]);
26
- context.have = await planner.have(projectId);
27
- context.want = await planner.want({
28
- projectId,
29
- projectNumber,
30
- aliases,
31
- projectDir: options.config.projectDir,
32
- extensions: options.config.get("extensions"),
33
- });
32
+ context.want = wantExtensions;
33
+ context.have = haveExtensions;
34
34
  const etagsChanged = (0, etags_1.detectEtagChanges)(options.rc, projectId, context.have);
35
35
  if (etagsChanged.length) {
36
- (0, warnings_1.outOfBandChangesWarning)(etagsChanged);
37
- if (!(await prompt.confirm({
38
- message: `Do you wish to continue deploying these extension instances?`,
39
- default: false,
40
- nonInteractive: options.nonInteractive,
41
- force: options.force,
42
- }))) {
43
- throw new error_1.FirebaseError("Deployment cancelled");
36
+ const wantChangedIds = wantExtensions
37
+ .map((e) => e.instanceId)
38
+ .filter((id) => etagsChanged.includes(id));
39
+ if (wantChangedIds.length) {
40
+ (0, warnings_1.outOfBandChangesWarning)(wantChangedIds, isDynamic);
41
+ if (!(await prompt.confirm({
42
+ message: `Do you wish to continue deploying these extension instances?`,
43
+ default: false,
44
+ nonInteractive: options.nonInteractive,
45
+ force: options.force,
46
+ }))) {
47
+ throw new error_1.FirebaseError("Deployment cancelled");
48
+ }
44
49
  }
45
50
  }
46
51
  const usingSecrets = await Promise.all(context.want?.map(secrets_1.checkSpecForSecrets));
@@ -79,15 +84,20 @@ async function prepare(context, options, payload) {
79
84
  logger_1.logger.info(deploymentSummary.configuresSummary(payload.instancesToConfigure));
80
85
  }
81
86
  if (payload.instancesToDelete.length) {
82
- logger_1.logger.info(deploymentSummary.deletesSummary(payload.instancesToDelete));
83
- if (!(await prompt.confirm({
84
- message: `Would you like to delete ${payload.instancesToDelete
85
- .map((i) => i.instanceId)
86
- .join(", ")}?`,
87
- default: false,
88
- nonInteractive: options.nonInteractive,
89
- force: options.force,
90
- }))) {
87
+ logger_1.logger.info(deploymentSummary.deletesSummary(payload.instancesToDelete, isDynamic));
88
+ if (options.dryRun) {
89
+ logger_1.logger.info("On your next deploy, you will be asked if you want to delete these instances.");
90
+ logger_1.logger.info("If you deploy --force, they will be deleted.");
91
+ }
92
+ if (!options.dryRun &&
93
+ !(await prompt.confirm({
94
+ message: `Would you like to delete ${payload.instancesToDelete
95
+ .map((i) => i.instanceId)
96
+ .join(", ")}?`,
97
+ default: false,
98
+ nonInteractive: options.nonInteractive,
99
+ force: options.force,
100
+ }))) {
91
101
  payload.instancesToDelete = [];
92
102
  }
93
103
  else {
@@ -95,15 +105,52 @@ async function prepare(context, options, payload) {
95
105
  }
96
106
  }
97
107
  await (0, requirePermissions_1.requirePermissions)(options, permissionsNeeded);
98
- await (0, tos_1.acceptLatestAppDeveloperTOS)(options, projectId, context.want.map((i) => i.instanceId));
108
+ if (options.dryRun) {
109
+ const appDevTos = await (0, tos_1.getAppDeveloperTOSStatus)(projectId);
110
+ if (!appDevTos.lastAcceptedVersion) {
111
+ logger_1.logger.info("On your next deploy, you will be asked to accept the Firebase Extensions App Developer Terms of Service");
112
+ }
113
+ }
114
+ else {
115
+ await (0, tos_1.acceptLatestAppDeveloperTOS)(options, projectId, context.want.map((i) => i.instanceId));
116
+ }
117
+ }
118
+ async function prepareDynamicExtensions(context, options, payload, builds) {
119
+ const filters = (0, functionsDeployHelper_1.getEndpointFilters)(options);
120
+ const extensions = (0, common_1.extractExtensionsFromBuilds)(builds, filters);
121
+ const projectId = (0, projectUtils_1.needProjectId)(options);
122
+ const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
123
+ await (0, extensionsHelper_1.ensureExtensionsApiEnabled)(options);
124
+ await (0, requirePermissions_1.requirePermissions)(options, ["firebaseextensions.instances.list"]);
125
+ let haveExtensions = await planner.haveDynamic(projectId);
126
+ haveExtensions = haveExtensions.filter((e) => (0, common_1.extensionMatchesAnyFilter)(e.labels?.codebase, e.instanceId, filters));
127
+ if (Object.keys(extensions).length === 0 && haveExtensions.length === 0) {
128
+ return;
129
+ }
130
+ const dynamicWant = await planner.wantDynamic({
131
+ projectId,
132
+ projectNumber,
133
+ extensions,
134
+ });
135
+ return prepareHelper(context, options, payload, dynamicWant, haveExtensions, true);
136
+ }
137
+ exports.prepareDynamicExtensions = prepareDynamicExtensions;
138
+ async function prepare(context, options, payload) {
139
+ context.extensionsStartTime = Date.now();
140
+ const projectId = (0, projectUtils_1.needProjectId)(options);
141
+ const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
142
+ const aliases = (0, projectUtils_1.getAliases)(options, projectId);
143
+ const projectDir = options.config.projectDir;
144
+ await (0, extensionsHelper_1.ensureExtensionsApiEnabled)(options);
145
+ await (0, requirePermissions_1.requirePermissions)(options, ["firebaseextensions.instances.list"]);
146
+ const wantExtensions = await planner.want({
147
+ projectId,
148
+ projectNumber,
149
+ aliases,
150
+ projectDir,
151
+ extensions: options.config.get("extensions", {}),
152
+ });
153
+ const haveExtensions = await planner.have(projectId);
154
+ return prepareHelper(context, options, payload, wantExtensions, haveExtensions, false);
99
155
  }
100
156
  exports.prepare = prepare;
101
- const matchesInstanceId = (dep) => (test) => {
102
- return dep.instanceId === test.instanceId;
103
- };
104
- const isUpdate = (dep) => (test) => {
105
- return dep.instanceId === test.instanceId && !refs.equal(dep.ref, test.ref);
106
- };
107
- const isConfigure = (dep) => (test) => {
108
- return dep.instanceId === test.instanceId && refs.equal(dep.ref, test.ref);
109
- };
@@ -10,6 +10,12 @@ const projectUtils_1 = require("../../projectUtils");
10
10
  const etags_1 = require("../../extensions/etags");
11
11
  const track_1 = require("../../track");
12
12
  async function release(context, options, payload) {
13
+ if (!payload.instancesToCreate &&
14
+ !payload.instancesToUpdate &&
15
+ !payload.instancesToConfigure &&
16
+ !payload.instancesToDelete) {
17
+ return;
18
+ }
13
19
  const projectId = (0, projectUtils_1.needProjectId)(options);
14
20
  const errorHandler = new errors_1.ErrorHandler();
15
21
  const deploymentQueue = new queue_1.default({
@@ -17,20 +23,20 @@ async function release(context, options, payload) {
17
23
  concurrency: 5,
18
24
  handler: tasks.extensionsDeploymentHandler(errorHandler),
19
25
  });
20
- for (const creation of payload.instancesToCreate ?? []) {
21
- const task = tasks.createExtensionInstanceTask(projectId, creation);
26
+ for (const inst of payload.instancesToConfigure ?? []) {
27
+ const task = tasks.configureExtensionInstanceTask(projectId, inst);
22
28
  void deploymentQueue.run(task);
23
29
  }
24
- for (const update of payload.instancesToUpdate ?? []) {
25
- const task = tasks.updateExtensionInstanceTask(projectId, update);
30
+ for (const inst of payload.instancesToDelete ?? []) {
31
+ const task = tasks.deleteExtensionInstanceTask(projectId, inst);
26
32
  void deploymentQueue.run(task);
27
33
  }
28
- for (const update of payload.instancesToConfigure ?? []) {
29
- const task = tasks.configureExtensionInstanceTask(projectId, update);
34
+ for (const inst of payload.instancesToCreate ?? []) {
35
+ const task = tasks.createExtensionInstanceTask(projectId, inst);
30
36
  void deploymentQueue.run(task);
31
37
  }
32
- for (const deletion of payload.instancesToDelete ?? []) {
33
- const task = tasks.deleteExtensionInstanceTask(projectId, deletion);
38
+ for (const inst of payload.instancesToUpdate ?? []) {
39
+ const task = tasks.updateExtensionInstanceTask(projectId, inst);
34
40
  void deploymentQueue.run(task);
35
41
  }
36
42
  const deploymentPromise = deploymentQueue.wait();
@@ -46,8 +52,9 @@ async function release(context, options, payload) {
46
52
  errors: errorHandler.errors.length ?? 0,
47
53
  interactive: options.nonInteractive ? "false" : "true",
48
54
  }, duration);
49
- const newHave = await planner.have(projectId);
50
- (0, etags_1.saveEtags)(options.rc, projectId, newHave);
55
+ const have = await planner.have(projectId);
56
+ const dynamicHave = await planner.haveDynamic(projectId);
57
+ (0, etags_1.saveEtags)(options.rc, projectId, have.concat(dynamicHave));
51
58
  if (errorHandler.hasErrors()) {
52
59
  errorHandler.print();
53
60
  throw new error_1.FirebaseError(`Extensions deployment failed.`);
@@ -7,6 +7,7 @@ const extensionsApi = require("../../extensions/extensionsApi");
7
7
  const extensionsHelper_1 = require("../../extensions/extensionsHelper");
8
8
  const refs = require("../../extensions/refs");
9
9
  const utils = require("../../utils");
10
+ const types_1 = require("../../extensions/types");
10
11
  const isRetryable = (err) => err.status === 429 || err.status === 409;
11
12
  function extensionsDeploymentHandler(errorHandler) {
12
13
  return async (task) => {
@@ -26,34 +27,37 @@ function extensionsDeploymentHandler(errorHandler) {
26
27
  exports.extensionsDeploymentHandler = extensionsDeploymentHandler;
27
28
  function createExtensionInstanceTask(projectId, instanceSpec, validateOnly = false) {
28
29
  const run = async () => {
30
+ if (!validateOnly) {
31
+ utils.logLabeledBullet("extensions", `Creating ${clc.bold(instanceSpec.instanceId)} extension instance`);
32
+ }
33
+ const createArgs = {
34
+ projectId,
35
+ instanceId: instanceSpec.instanceId,
36
+ params: instanceSpec.params,
37
+ systemParams: instanceSpec.systemParams,
38
+ allowedEventTypes: instanceSpec.allowedEventTypes,
39
+ eventarcChannel: instanceSpec.eventarcChannel,
40
+ validateOnly,
41
+ labels: instanceSpec.labels,
42
+ };
29
43
  if (instanceSpec.ref) {
30
- await extensionsApi.createInstance({
31
- projectId,
32
- instanceId: instanceSpec.instanceId,
33
- params: instanceSpec.params,
34
- systemParams: instanceSpec.systemParams,
35
- extensionVersionRef: refs.toExtensionVersionRef(instanceSpec.ref),
36
- allowedEventTypes: instanceSpec.allowedEventTypes,
37
- eventarcChannel: instanceSpec.eventarcChannel,
38
- validateOnly,
39
- });
44
+ createArgs.extensionVersionRef = refs.toExtensionVersionRef(instanceSpec.ref);
40
45
  }
41
46
  else if (instanceSpec.localPath) {
42
- const extensionSource = await (0, extensionsHelper_1.createSourceFromLocation)(projectId, instanceSpec.localPath);
43
- await extensionsApi.createInstance({
44
- projectId,
45
- instanceId: instanceSpec.instanceId,
46
- params: instanceSpec.params,
47
- systemParams: instanceSpec.systemParams,
48
- extensionSource,
49
- allowedEventTypes: instanceSpec.allowedEventTypes,
50
- eventarcChannel: instanceSpec.eventarcChannel,
51
- validateOnly,
52
- });
47
+ createArgs.extensionSource = await (0, extensionsHelper_1.createSourceFromLocation)(projectId, instanceSpec.localPath);
53
48
  }
54
49
  else {
55
50
  throw new error_1.FirebaseError(`Tried to create extension instance ${instanceSpec.instanceId} without a ref or a local path. This should never happen.`);
56
51
  }
52
+ try {
53
+ await extensionsApi.createInstance(createArgs);
54
+ }
55
+ catch (err) {
56
+ if ((0, types_1.isObject)(err) && err.status === 409) {
57
+ throw new error_1.FirebaseError(`Failed to create extension instance. Extension instance ${clc.bold(instanceSpec.instanceId)} already exists.`);
58
+ }
59
+ throw err;
60
+ }
57
61
  printSuccess(instanceSpec.instanceId, "create", validateOnly);
58
62
  return;
59
63
  };
@@ -66,6 +70,9 @@ function createExtensionInstanceTask(projectId, instanceSpec, validateOnly = fal
66
70
  exports.createExtensionInstanceTask = createExtensionInstanceTask;
67
71
  function updateExtensionInstanceTask(projectId, instanceSpec, validateOnly = false) {
68
72
  const run = async () => {
73
+ if (!validateOnly) {
74
+ utils.logLabeledBullet("extensions", `Updating ${clc.bold(instanceSpec.instanceId)} extension instance`);
75
+ }
69
76
  if (instanceSpec.ref) {
70
77
  await extensionsApi.updateInstanceFromRegistry({
71
78
  projectId,
@@ -108,6 +115,9 @@ function updateExtensionInstanceTask(projectId, instanceSpec, validateOnly = fal
108
115
  exports.updateExtensionInstanceTask = updateExtensionInstanceTask;
109
116
  function configureExtensionInstanceTask(projectId, instanceSpec, validateOnly = false) {
110
117
  const run = async () => {
118
+ if (!validateOnly) {
119
+ utils.logLabeledBullet("extensions", `Configuring ${clc.bold(instanceSpec.instanceId)} extension instance`);
120
+ }
111
121
  if (instanceSpec.ref) {
112
122
  await extensionsApi.configureInstance({
113
123
  projectId,
@@ -138,6 +148,7 @@ function configureExtensionInstanceTask(projectId, instanceSpec, validateOnly =
138
148
  exports.configureExtensionInstanceTask = configureExtensionInstanceTask;
139
149
  function deleteExtensionInstanceTask(projectId, instanceSpec) {
140
150
  const run = async () => {
151
+ utils.logLabeledBullet("extensions", `Deleting ${clc.bold(instanceSpec.instanceId)} extension instance`);
141
152
  await extensionsApi.deleteInstance(projectId, instanceSpec.instanceId);
142
153
  printSuccess(instanceSpec.instanceId, "delete", false);
143
154
  return;
@@ -5,6 +5,7 @@ const loadCJSON_1 = require("../../loadCJSON");
5
5
  const rulesDeploy_1 = require("../../rulesDeploy");
6
6
  const utils = require("../../utils");
7
7
  const fsConfig = require("../../firestore/fsConfig");
8
+ const logger_1 = require("../../logger");
8
9
  function prepareRules(context, rulesDeploy, databaseId, rulesFile) {
9
10
  rulesDeploy.addFile(rulesFile);
10
11
  context.firestore.rules.push({
@@ -57,5 +58,13 @@ async function default_1(context, options) {
57
58
  if (context.firestore.rules.length > 0) {
58
59
  await rulesDeploy.compile();
59
60
  }
61
+ const rulesContext = context?.firestore?.rules;
62
+ for (const ruleContext of rulesContext) {
63
+ const databaseId = ruleContext.databaseId;
64
+ const rulesFile = ruleContext.rulesFile;
65
+ if (!rulesFile) {
66
+ logger_1.logger.error(`Invalid firestore config for ${databaseId} database: ${JSON.stringify(options.config.src.firestore)}`);
67
+ }
68
+ }
60
69
  }
61
70
  exports.default = default_1;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const rulesDeploy_1 = require("../../rulesDeploy");
4
- const logger_1 = require("../../logger");
5
- async function default_1(context, options) {
4
+ async function default_1(context) {
6
5
  const rulesDeploy = context?.firestore?.rulesDeploy;
7
6
  if (!context.firestoreRules || !rulesDeploy) {
8
7
  return;
@@ -11,11 +10,9 @@ async function default_1(context, options) {
11
10
  await Promise.all(rulesContext.map(async (ruleContext) => {
12
11
  const databaseId = ruleContext.databaseId;
13
12
  const rulesFile = ruleContext.rulesFile;
14
- if (!rulesFile) {
15
- logger_1.logger.error(`Invalid firestore config for ${databaseId} database: ${JSON.stringify(options.config.src.firestore)}`);
16
- return;
13
+ if (rulesFile) {
14
+ return rulesDeploy.release(rulesFile, rulesDeploy_1.RulesetServiceType.CLOUD_FIRESTORE, databaseId);
17
15
  }
18
- return rulesDeploy.release(rulesFile, rulesDeploy_1.RulesetServiceType.CLOUD_FIRESTORE, databaseId);
19
16
  }));
20
17
  }
21
18
  exports.default = default_1;