firebase-tools 13.5.1 → 13.6.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 (83) hide show
  1. package/lib/accountExporter.js +1 -1
  2. package/lib/accountImporter.js +1 -1
  3. package/lib/api.js +112 -56
  4. package/lib/apiv2.js +3 -1
  5. package/lib/appdistribution/client.js +4 -4
  6. package/lib/auth.js +17 -17
  7. package/lib/commands/hosting-disable.js +1 -1
  8. package/lib/commands/open.js +1 -1
  9. package/lib/database/metadata.js +3 -3
  10. package/lib/defaultCredentials.js +2 -2
  11. package/lib/deploy/extensions/v2FunctionHelper.js +1 -1
  12. package/lib/deploy/functions/build.js +1 -1
  13. package/lib/deploy/functions/containerCleaner.js +4 -4
  14. package/lib/deploy/functions/deploy.js +8 -2
  15. package/lib/deploy/functions/ensure.js +1 -1
  16. package/lib/deploy/functions/prepare.js +5 -4
  17. package/lib/deploy/functions/release/fabricator.js +3 -3
  18. package/lib/deploy/functions/runtimes/discovery/index.js +2 -2
  19. package/lib/deploy/functions/runtimes/node/parseTriggers.js +2 -2
  20. package/lib/deploy/hosting/uploader.js +1 -1
  21. package/lib/deploy/index.js +1 -1
  22. package/lib/deploy/remoteconfig/functions.js +1 -1
  23. package/lib/emulator/adminSdkConfig.js +1 -1
  24. package/lib/emulator/downloadableEmulators.js +6 -6
  25. package/lib/ensureApiEnabled.js +1 -1
  26. package/lib/extensions/extensionsApi.js +5 -5
  27. package/lib/extensions/extensionsHelper.js +4 -4
  28. package/lib/extensions/provisioningHelper.js +2 -2
  29. package/lib/extensions/publishHelpers.js +1 -1
  30. package/lib/extensions/publisherApi.js +3 -3
  31. package/lib/extensions/resolveSource.js +1 -1
  32. package/lib/extensions/secretsUtils.js +1 -1
  33. package/lib/extensions/tos.js +1 -1
  34. package/lib/fetchMOTD.js +1 -1
  35. package/lib/fetchWebSetup.js +2 -2
  36. package/lib/firestore/api-sort.js +17 -0
  37. package/lib/firestore/api.js +9 -2
  38. package/lib/firestore/checkDatabaseType.js +1 -1
  39. package/lib/firestore/delete.js +1 -1
  40. package/lib/firestore/pretty-print.js +11 -2
  41. package/lib/functions/secrets.js +3 -3
  42. package/lib/functionsConfig.js +1 -1
  43. package/lib/gcp/apphosting.js +2 -2
  44. package/lib/gcp/artifactregistry.js +1 -1
  45. package/lib/gcp/auth.js +1 -1
  46. package/lib/gcp/cloudbilling.js +1 -1
  47. package/lib/gcp/cloudbuild.js +1 -1
  48. package/lib/gcp/cloudfunctions.js +1 -1
  49. package/lib/gcp/cloudfunctionsv2.js +1 -1
  50. package/lib/gcp/cloudlogging.js +1 -1
  51. package/lib/gcp/cloudmonitoring.js +1 -1
  52. package/lib/gcp/cloudscheduler.js +1 -1
  53. package/lib/gcp/cloudtasks.js +1 -1
  54. package/lib/gcp/devConnect.js +81 -0
  55. package/lib/gcp/eventarc.js +1 -1
  56. package/lib/gcp/firestore.js +2 -2
  57. package/lib/gcp/iam.js +2 -2
  58. package/lib/gcp/identityPlatform.js +1 -1
  59. package/lib/gcp/pubsub.js +1 -1
  60. package/lib/gcp/resourceManager.js +2 -1
  61. package/lib/gcp/rules.js +1 -1
  62. package/lib/gcp/run.js +1 -1
  63. package/lib/gcp/runtimeconfig.js +1 -1
  64. package/lib/gcp/secretManager.js +1 -1
  65. package/lib/gcp/serviceusage.js +1 -1
  66. package/lib/gcp/storage.js +12 -8
  67. package/lib/hosting/api.js +2 -2
  68. package/lib/hosting/cloudRunProxy.js +1 -1
  69. package/lib/init/features/apphosting/index.js +29 -7
  70. package/lib/init/features/apphosting/repo.js +88 -102
  71. package/lib/init/features/database.js +1 -1
  72. package/lib/init/features/extensions/index.js +1 -1
  73. package/lib/init/features/functions/index.js +2 -2
  74. package/lib/init/features/hosting/github.js +4 -3
  75. package/lib/management/apps.js +4 -4
  76. package/lib/management/database.js +1 -1
  77. package/lib/management/projects.js +4 -4
  78. package/lib/remoteconfig/get.js +1 -1
  79. package/lib/remoteconfig/rollback.js +1 -1
  80. package/lib/remoteconfig/versionslist.js +1 -1
  81. package/lib/shortenUrl.js +2 -2
  82. package/lib/utils.js +1 -1
  83. package/package.json +1 -1
@@ -24,7 +24,7 @@ function progressMessage(message, current, total) {
24
24
  class Uploader {
25
25
  constructor(options) {
26
26
  this.hashClient = new apiv2_1.Client({
27
- urlPrefix: api_1.hostingApiOrigin,
27
+ urlPrefix: (0, api_1.hostingApiOrigin)(),
28
28
  auth: true,
29
29
  apiVersion: "v1beta1",
30
30
  });
@@ -115,7 +115,7 @@ const deploy = async function (targetNames, options, customContext = {}) {
115
115
  logger_1.logger.info((0, colorette_1.bold)("Project Console:"), (0, utils_1.consoleUrl)(options.project, "/overview"));
116
116
  if (deployedHosting) {
117
117
  (0, lodash_1.each)(context.hosting.deploys, (deploy) => {
118
- logger_1.logger.info((0, colorette_1.bold)("Hosting URL:"), (0, utils_1.addSubdomain)(api_1.hostingOrigin, deploy.config.site));
118
+ logger_1.logger.info((0, colorette_1.bold)("Hosting URL:"), (0, utils_1.addSubdomain)((0, api_1.hostingOrigin)(), deploy.config.site));
119
119
  });
120
120
  const versionNames = context.hosting.deploys.map((deploy) => deploy.version);
121
121
  return { hosting: versionNames.length === 1 ? versionNames[0] : versionNames };
@@ -5,7 +5,7 @@ const api_1 = require("../../api");
5
5
  const apiv2_1 = require("../../apiv2");
6
6
  const error_1 = require("../../error");
7
7
  const TIMEOUT = 30000;
8
- const client = new apiv2_1.Client({ urlPrefix: api_1.remoteConfigApiOrigin, apiVersion: "v1" });
8
+ const client = new apiv2_1.Client({ urlPrefix: (0, api_1.remoteConfigApiOrigin)(), apiVersion: "v1" });
9
9
  async function getEtag(projectNumber, versionNumber) {
10
10
  const reqPath = `/projects/${projectNumber}/remoteConfig`;
11
11
  const queryParams = {};
@@ -35,7 +35,7 @@ async function getProjectAdminSdkConfig(projectId) {
35
35
  const apiClient = new apiv2.Client({
36
36
  auth: true,
37
37
  apiVersion: "v1beta1",
38
- urlPrefix: api_1.firebaseApiOrigin,
38
+ urlPrefix: (0, api_1.firebaseApiOrigin)(),
39
39
  });
40
40
  if (projectId.startsWith("demo-")) {
41
41
  logger_1.logger.debug(`Detected demo- project: ${projectId}. Using default adminSdkConfig instead of calling firebase API.`);
@@ -23,9 +23,9 @@ const EMULATOR_UPDATE_DETAILS = {
23
23
  expectedChecksum: "2fd771101c0e1f7898c04c9204f2ce63",
24
24
  },
25
25
  firestore: {
26
- version: "1.19.3",
27
- expectedSize: 67296394,
28
- expectedChecksum: "08a9b882a5c38570b6333f3931b1e52b",
26
+ version: "1.19.4",
27
+ expectedSize: 65913000,
28
+ expectedChecksum: "a861bfa9d12ef69645b41e2f3bd8db8d",
29
29
  },
30
30
  storage: {
31
31
  version: "1.1.3",
@@ -40,9 +40,9 @@ const EMULATOR_UPDATE_DETAILS = {
40
40
  expectedChecksum: "49f6dc1911dda9d10df62a6c09aaf9a0",
41
41
  },
42
42
  pubsub: {
43
- version: "0.7.1",
44
- expectedSize: 65137179,
45
- expectedChecksum: "b59a6e705031a54a69e5e1dced7ca9bf",
43
+ version: "0.8.2",
44
+ expectedSize: 65611398,
45
+ expectedChecksum: "70bb840321423e6ae621a3ae2f314903",
46
46
  },
47
47
  };
48
48
  exports.DownloadDetails = {
@@ -12,7 +12,7 @@ exports.POLL_SETTINGS = {
12
12
  pollsBeforeRetry: 12,
13
13
  };
14
14
  const apiClient = new apiv2_1.Client({
15
- urlPrefix: api_1.serviceUsageOrigin,
15
+ urlPrefix: (0, api_1.serviceUsageOrigin)(),
16
16
  apiVersion: "v1",
17
17
  });
18
18
  async function check(projectId, apiUri, prefix, silent = false) {
@@ -12,7 +12,7 @@ const refs = require("./refs");
12
12
  const EXTENSIONS_API_VERSION = "v1beta";
13
13
  const PAGE_SIZE_MAX = 100;
14
14
  const extensionsApiClient = new apiv2_1.Client({
15
- urlPrefix: api_1.extensionsOrigin,
15
+ urlPrefix: (0, api_1.extensionsOrigin)(),
16
16
  apiVersion: EXTENSIONS_API_VERSION,
17
17
  });
18
18
  async function createInstanceHelper(projectId, instanceId, config, validateOnly = false) {
@@ -28,7 +28,7 @@ async function createInstanceHelper(projectId, instanceId, config, validateOnly
28
28
  return createRes.body;
29
29
  }
30
30
  const pollRes = await operationPoller.pollOperation({
31
- apiOrigin: api_1.extensionsOrigin,
31
+ apiOrigin: (0, api_1.extensionsOrigin)(),
32
32
  apiVersion: EXTENSIONS_API_VERSION,
33
33
  operationResourceName: createRes.body.name,
34
34
  masterTimeout: 3600000,
@@ -69,7 +69,7 @@ exports.createInstance = createInstance;
69
69
  async function deleteInstance(projectId, instanceId) {
70
70
  const deleteRes = await extensionsApiClient.delete(`/projects/${projectId}/instances/${instanceId}`);
71
71
  const pollRes = await operationPoller.pollOperation({
72
- apiOrigin: api_1.extensionsOrigin,
72
+ apiOrigin: (0, api_1.extensionsOrigin)(),
73
73
  apiVersion: EXTENSIONS_API_VERSION,
74
74
  operationResourceName: deleteRes.body.name,
75
75
  masterTimeout: 600000,
@@ -217,7 +217,7 @@ async function patchInstance(args) {
217
217
  return updateRes;
218
218
  }
219
219
  const pollRes = await operationPoller.pollOperation({
220
- apiOrigin: api_1.extensionsOrigin,
220
+ apiOrigin: (0, api_1.extensionsOrigin)(),
221
221
  apiVersion: EXTENSIONS_API_VERSION,
222
222
  operationResourceName: updateRes.body.name,
223
223
  masterTimeout: 600000,
@@ -248,7 +248,7 @@ async function createSource(projectId, packageUri, extensionRoot) {
248
248
  extensionRoot,
249
249
  });
250
250
  const pollRes = await operationPoller.pollOperation({
251
- apiOrigin: api_1.extensionsOrigin,
251
+ apiOrigin: (0, api_1.extensionsOrigin)(),
252
252
  apiVersion: EXTENSIONS_API_VERSION,
253
253
  operationResourceName: createRes.body.name,
254
254
  masterTimeout: 600000,
@@ -353,7 +353,7 @@ async function ensureExtensionsApiEnabled(options) {
353
353
  if (!projectId) {
354
354
  return;
355
355
  }
356
- return await (0, ensureApiEnabled_1.ensure)(projectId, api_1.extensionsOrigin, "extensions", options.markdown);
356
+ return await (0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.extensionsOrigin)(), "extensions", options.markdown);
357
357
  }
358
358
  exports.ensureExtensionsApiEnabled = ensureExtensionsApiEnabled;
359
359
  async function ensureExtensionsPublisherApiEnabled(options) {
@@ -361,7 +361,7 @@ async function ensureExtensionsPublisherApiEnabled(options) {
361
361
  if (!projectId) {
362
362
  return;
363
363
  }
364
- return await (0, ensureApiEnabled_1.ensure)(projectId, api_1.extensionsPublisherOrigin, "extensions", options.markdown);
364
+ return await (0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.extensionsPublisherOrigin)(), "extensions", options.markdown);
365
365
  }
366
366
  exports.ensureExtensionsPublisherApiEnabled = ensureExtensionsPublisherApiEnabled;
367
367
  async function archiveAndUploadSource(extPath, bucketName) {
@@ -674,7 +674,7 @@ async function uploadExtensionVersionFromLocalSource(args) {
674
674
  uploadSpinner.start();
675
675
  objectPath = await archiveAndUploadSource(args.rootDirectory, exports.EXTENSIONS_BUCKET_NAME);
676
676
  uploadSpinner.succeed("Uploaded extension source code");
677
- packageUri = api_1.storageOrigin + objectPath + "?alt=media";
677
+ packageUri = (0, api_1.storageOrigin)() + objectPath + "?alt=media";
678
678
  }
679
679
  catch (err) {
680
680
  uploadSpinner.fail();
@@ -713,7 +713,7 @@ async function createSourceFromLocation(projectId, sourceUri) {
713
713
  spinner.start();
714
714
  objectPath = await archiveAndUploadSource(sourceUri, exports.EXTENSIONS_BUCKET_NAME);
715
715
  spinner.succeed(" Uploaded extension source code");
716
- packageUri = api_1.storageOrigin + objectPath + "?alt=media";
716
+ packageUri = (0, api_1.storageOrigin)() + objectPath + "?alt=media";
717
717
  const res = await (0, extensionsApi_1.createSource)(projectId, packageUri, extensionRoot);
718
718
  logger_1.logger.debug("Created new Extension Source %s", res.name);
719
719
  await deleteUploadedSource(objectPath);
@@ -92,7 +92,7 @@ function getTriggerType(propertiesYaml) {
92
92
  }
93
93
  async function isStorageProvisioned(projectId) {
94
94
  var _a, _b;
95
- const client = new apiv2_1.Client({ urlPrefix: api_1.firebaseStorageOrigin, apiVersion: "v1beta" });
95
+ const client = new apiv2_1.Client({ urlPrefix: (0, api_1.firebaseStorageOrigin)(), apiVersion: "v1beta" });
96
96
  const resp = await client.get(`/projects/${projectId}/buckets`);
97
97
  return !!((_b = (_a = resp.body) === null || _a === void 0 ? void 0 : _a.buckets) === null || _b === void 0 ? void 0 : _b.find((bucket) => {
98
98
  const bucketResourceName = bucket.name;
@@ -103,7 +103,7 @@ async function isStorageProvisioned(projectId) {
103
103
  }
104
104
  async function isAuthProvisioned(projectId) {
105
105
  var _a, _b;
106
- const client = new apiv2_1.Client({ urlPrefix: api_1.firedataOrigin, apiVersion: "v1" });
106
+ const client = new apiv2_1.Client({ urlPrefix: (0, api_1.firedataOrigin)(), apiVersion: "v1" });
107
107
  const resp = await client.get(`/projects/${projectId}/products`);
108
108
  return !!((_b = (_a = resp.body) === null || _a === void 0 ? void 0 : _a.activation) === null || _b === void 0 ? void 0 : _b.map((a) => a.service).includes("FIREBASE_AUTH"));
109
109
  }
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.consoleInstallLink = void 0;
4
4
  const api_1 = require("../api");
5
5
  function consoleInstallLink(extVersionRef) {
6
- return `${api_1.consoleOrigin}/project/_/extensions/install?ref=${extVersionRef}`;
6
+ return `${(0, api_1.consoleOrigin)()}/project/_/extensions/install?ref=${extVersionRef}`;
7
7
  }
8
8
  exports.consoleInstallLink = consoleInstallLink;
@@ -11,7 +11,7 @@ const extensionsApi_1 = require("./extensionsApi");
11
11
  const PUBLISHER_API_VERSION = "v1beta";
12
12
  const PAGE_SIZE_MAX = 100;
13
13
  const extensionsPublisherApiClient = new apiv2_1.Client({
14
- urlPrefix: api_1.extensionsPublisherOrigin,
14
+ urlPrefix: (0, api_1.extensionsPublisherOrigin)(),
15
15
  apiVersion: PUBLISHER_API_VERSION,
16
16
  });
17
17
  async function getPublisherProfile(projectId, publisherId) {
@@ -97,7 +97,7 @@ async function createExtensionVersionFromLocalSource(args) {
97
97
  },
98
98
  });
99
99
  const pollRes = await operationPoller.pollOperation({
100
- apiOrigin: api_1.extensionsPublisherOrigin,
100
+ apiOrigin: (0, api_1.extensionsPublisherOrigin)(),
101
101
  apiVersion: PUBLISHER_API_VERSION,
102
102
  operationResourceName: uploadRes.body.name,
103
103
  masterTimeout: 600000,
@@ -119,7 +119,7 @@ async function createExtensionVersionFromGitHubSource(args) {
119
119
  },
120
120
  });
121
121
  const pollRes = await operationPoller.pollOperation({
122
- apiOrigin: api_1.extensionsPublisherOrigin,
122
+ apiOrigin: (0, api_1.extensionsPublisherOrigin)(),
123
123
  apiVersion: PUBLISHER_API_VERSION,
124
124
  operationResourceName: uploadRes.body.name,
125
125
  masterTimeout: 600000,
@@ -6,7 +6,7 @@ const api_1 = require("../api");
6
6
  const EXTENSIONS_REGISTRY_ENDPOINT = "/extensions.json";
7
7
  async function getExtensionRegistry(onlyFeatured = false) {
8
8
  var _a;
9
- const client = new apiv2_1.Client({ urlPrefix: api_1.firebaseExtensionsRegistryOrigin });
9
+ const client = new apiv2_1.Client({ urlPrefix: (0, api_1.firebaseExtensionsRegistryOrigin)() });
10
10
  const res = await client.get(EXTENSIONS_REGISTRY_ENDPOINT);
11
11
  const extensions = res.body.mods || {};
12
12
  if (onlyFeatured) {
@@ -13,7 +13,7 @@ exports.SECRET_LABEL = "firebase-extensions-managed";
13
13
  exports.SECRET_ROLE = "secretmanager.secretAccessor";
14
14
  async function ensureSecretManagerApiEnabled(options) {
15
15
  const projectId = (0, projectUtils_1.needProjectId)(options);
16
- return await (0, ensureApiEnabled_1.ensure)(projectId, api_1.secretManagerOrigin, "extensions", options.markdown);
16
+ return await (0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.secretManagerOrigin)(), "extensions", options.markdown);
17
17
  }
18
18
  exports.ensureSecretManagerApiEnabled = ensureSecretManagerApiEnabled;
19
19
  function usesSecrets(spec) {
@@ -10,7 +10,7 @@ const extensionsHelper_1 = require("./extensionsHelper");
10
10
  const utils = require("../utils");
11
11
  const VERSION = "v1";
12
12
  const extensionsTosUrl = (tos) => `https://firebase.google.com/terms/extensions/${tos}`;
13
- const apiClient = new apiv2_1.Client({ urlPrefix: api_1.extensionsTOSOrigin, apiVersion: VERSION });
13
+ const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.extensionsTOSOrigin)(), apiVersion: VERSION });
14
14
  async function getAppDeveloperTOSStatus(projectId) {
15
15
  const res = await apiClient.get(`/projects/${projectId}/appdevtos`);
16
16
  return res.body;
package/lib/fetchMOTD.js CHANGED
@@ -29,7 +29,7 @@ function fetchMOTD() {
29
29
  }
30
30
  }
31
31
  else {
32
- const origin = utils.addSubdomain(api_1.realtimeOrigin, "firebase-public");
32
+ const origin = utils.addSubdomain((0, api_1.realtimeOrigin)(), "firebase-public");
33
33
  const c = new apiv2_1.Client({ urlPrefix: origin, auth: false });
34
34
  c.get("/cli.json")
35
35
  .then((res) => {
@@ -7,9 +7,9 @@ const api_1 = require("./api");
7
7
  const projectUtils_1 = require("./projectUtils");
8
8
  const logger_1 = require("./logger");
9
9
  const constants_1 = require("./emulator/constants");
10
- const apiClient = new apiv2_1.Client({ urlPrefix: api_1.firebaseApiOrigin, auth: true, apiVersion: "v1beta1" });
10
+ const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.firebaseApiOrigin)(), auth: true, apiVersion: "v1beta1" });
11
11
  const hostingApiClient = new apiv2_1.Client({
12
- urlPrefix: api_1.hostingApiOrigin,
12
+ urlPrefix: (0, api_1.hostingApiOrigin)(),
13
13
  auth: true,
14
14
  apiVersion: "v1beta1",
15
15
  });
@@ -100,6 +100,9 @@ function compareIndexField(a, b) {
100
100
  if (a.arrayConfig !== b.arrayConfig) {
101
101
  return compareArrayConfig(a.arrayConfig, b.arrayConfig);
102
102
  }
103
+ if (a.vectorConfig !== b.vectorConfig) {
104
+ return compareVectorConfig(a.vectorConfig, b.vectorConfig);
105
+ }
103
106
  return 0;
104
107
  }
105
108
  function compareFieldIndex(a, b) {
@@ -123,6 +126,20 @@ function compareOrder(a, b) {
123
126
  function compareArrayConfig(a, b) {
124
127
  return ARRAY_CONFIG_SEQUENCE.indexOf(a) - ARRAY_CONFIG_SEQUENCE.indexOf(b);
125
128
  }
129
+ function compareVectorConfig(a, b) {
130
+ if (!a) {
131
+ if (!b) {
132
+ return 0;
133
+ }
134
+ else {
135
+ return 1;
136
+ }
137
+ }
138
+ else if (!b) {
139
+ return -1;
140
+ }
141
+ return a.dimension - b.dimension;
142
+ }
126
143
  function compareArrays(a, b, fn) {
127
144
  const minFields = Math.min(a.length, b.length);
128
145
  for (let i = 0; i < minFields; i++) {
@@ -15,7 +15,7 @@ const apiv2_1 = require("../apiv2");
15
15
  const pretty_print_1 = require("./pretty-print");
16
16
  class FirestoreApi {
17
17
  constructor() {
18
- this.apiClient = new apiv2_1.Client({ urlPrefix: api_1.firestoreOrigin, apiVersion: "v1" });
18
+ this.apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.firestoreOrigin)(), apiVersion: "v1" });
19
19
  this.printer = new pretty_print_1.PrettyPrint();
20
20
  }
21
21
  async deploy(options, indexes, fieldOverrides, databaseId = "(default)") {
@@ -204,13 +204,17 @@ class FirestoreApi {
204
204
  validator.assertHas(index, "fields");
205
205
  index.fields.forEach((field) => {
206
206
  validator.assertHas(field, "fieldPath");
207
- validator.assertHasOneOf(field, ["order", "arrayConfig"]);
207
+ validator.assertHasOneOf(field, ["order", "arrayConfig", "vectorConfig"]);
208
208
  if (field.order) {
209
209
  validator.assertEnum(field, "order", Object.keys(types.Order));
210
210
  }
211
211
  if (field.arrayConfig) {
212
212
  validator.assertEnum(field, "arrayConfig", Object.keys(types.ArrayConfig));
213
213
  }
214
+ if (field.vectorConfig) {
215
+ validator.assertType("vectorConfig.dimension", field.vectorConfig.dimension, "number");
216
+ validator.assertHas(field.vectorConfig, "flat");
217
+ }
214
218
  });
215
219
  }
216
220
  validateField(field) {
@@ -373,6 +377,9 @@ class FirestoreApi {
373
377
  else if (field.arrayConfig) {
374
378
  f.arrayConfig = field.arrayConfig;
375
379
  }
380
+ else if (field.vectorConfig) {
381
+ f.vectorConfig = field.vectorConfig;
382
+ }
376
383
  else if (field.mode === types.Mode.ARRAY_CONTAINS) {
377
384
  f.arrayConfig = types.ArrayConfig.CONTAINS;
378
385
  }
@@ -6,7 +6,7 @@ const apiv2_1 = require("../apiv2");
6
6
  const logger_1 = require("../logger");
7
7
  async function checkDatabaseType(projectId) {
8
8
  try {
9
- const client = new apiv2_1.Client({ urlPrefix: api_1.firestoreOrigin, apiVersion: "v1" });
9
+ const client = new apiv2_1.Client({ urlPrefix: (0, api_1.firestoreOrigin)(), apiVersion: "v1" });
10
10
  const resp = await client.get(`/projects/${projectId}/databases/(default)`);
11
11
  return resp.body.type;
12
12
  }
@@ -41,7 +41,7 @@ class FirestoreDelete {
41
41
  this.apiClient = new apiv2.Client({
42
42
  auth: true,
43
43
  apiVersion: "v1",
44
- urlPrefix: api_1.firestoreOriginOrEmulator,
44
+ urlPrefix: (0, api_1.firestoreOriginOrEmulator)(),
45
45
  });
46
46
  }
47
47
  setDeleteBatchSize(size) {
@@ -140,8 +140,17 @@ class PrettyPrint {
140
140
  if (field.fieldPath === "__name__") {
141
141
  return;
142
142
  }
143
- const orderOrArrayConfig = field.order ? field.order : field.arrayConfig;
144
- result += `(${field.fieldPath},${orderOrArrayConfig}) `;
143
+ let configString;
144
+ if (field.order) {
145
+ configString = field.order;
146
+ }
147
+ else if (field.arrayConfig) {
148
+ configString = field.arrayConfig;
149
+ }
150
+ else if (field.vectorConfig) {
151
+ configString = `VECTOR<${field.vectorConfig.dimension}>`;
152
+ }
153
+ result += `(${field.fieldPath},${configString}) `;
145
154
  });
146
155
  return result;
147
156
  }
@@ -17,13 +17,13 @@ const functional_1 = require("../functional");
17
17
  const projectUtils_1 = require("../projectUtils");
18
18
  const FIREBASE_MANAGED = "firebase-managed";
19
19
  const gcfV1PollerOptions = {
20
- apiOrigin: api_1.functionsOrigin,
20
+ apiOrigin: (0, api_1.functionsOrigin)(),
21
21
  apiVersion: "v1",
22
22
  masterTimeout: 25 * 60 * 1000,
23
23
  maxBackoff: 10000,
24
24
  };
25
25
  const gcfV2PollerOptions = {
26
- apiOrigin: api_1.functionsV2Origin,
26
+ apiOrigin: (0, api_1.functionsV2Origin)(),
27
27
  apiVersion: "v2",
28
28
  masterTimeout: 25 * 60 * 1000,
29
29
  maxBackoff: 10000,
@@ -44,7 +44,7 @@ function toUpperSnakeCase(key) {
44
44
  }
45
45
  function ensureApi(options) {
46
46
  const projectId = (0, projectUtils_1.needProjectId)(options);
47
- return ensureApiEnabled.ensure(projectId, api_1.secretManagerOrigin, "secretmanager", true);
47
+ return ensureApiEnabled.ensure(projectId, (0, api_1.secretManagerOrigin)(), "secretmanager", true);
48
48
  }
49
49
  exports.ensureApi = ensureApi;
50
50
  async function ensureValidKey(key, options) {
@@ -10,7 +10,7 @@ const error_1 = require("./error");
10
10
  const projectUtils_1 = require("./projectUtils");
11
11
  const runtimeconfig = require("./gcp/runtimeconfig");
12
12
  exports.RESERVED_NAMESPACES = ["firebase"];
13
- const apiClient = new apiv2_1.Client({ urlPrefix: api_1.firebaseApiOrigin });
13
+ const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.firebaseApiOrigin)() });
14
14
  function keyToIds(key) {
15
15
  const keyParts = key.split(".");
16
16
  const variable = keyParts.slice(1).join("/");
@@ -11,7 +11,7 @@ const error_1 = require("../error");
11
11
  const metaprogramming_1 = require("../metaprogramming");
12
12
  exports.API_VERSION = "v1alpha";
13
13
  exports.client = new apiv2_1.Client({
14
- urlPrefix: api_1.apphostingOrigin,
14
+ urlPrefix: (0, api_1.apphostingOrigin)(),
15
15
  auth: true,
16
16
  apiVersion: exports.API_VERSION,
17
17
  });
@@ -125,7 +125,7 @@ async function listLocations(projectId) {
125
125
  exports.listLocations = listLocations;
126
126
  async function ensureApiEnabled(options) {
127
127
  const projectId = (0, projectUtils_1.needProjectId)(options);
128
- return await (0, ensureApiEnabled_1.ensure)(projectId, api_1.apphostingOrigin, "app hosting", true);
128
+ return await (0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.apphostingOrigin)(), "app hosting", true);
129
129
  }
130
130
  exports.ensureApiEnabled = ensureApiEnabled;
131
131
  async function getNextRolloutId(projectId, location, backendId, counter) {
@@ -5,7 +5,7 @@ const apiv2_1 = require("../apiv2");
5
5
  const api_1 = require("../api");
6
6
  exports.API_VERSION = "v1beta2";
7
7
  const client = new apiv2_1.Client({
8
- urlPrefix: api_1.artifactRegistryDomain,
8
+ urlPrefix: (0, api_1.artifactRegistryDomain)(),
9
9
  auth: true,
10
10
  apiVersion: exports.API_VERSION,
11
11
  });
package/lib/gcp/auth.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateAuthDomains = exports.getAuthDomains = void 0;
4
4
  const apiv2_1 = require("../apiv2");
5
5
  const api_1 = require("../api");
6
- const apiClient = new apiv2_1.Client({ urlPrefix: api_1.identityOrigin, auth: true });
6
+ const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.identityOrigin)(), auth: true });
7
7
  async function getAuthDomains(project) {
8
8
  const res = await apiClient.get(`/admin/v2/projects/${project}/config`, { headers: { "x-goog-user-project": project } });
9
9
  return res.body.authorizedDomains;
@@ -5,7 +5,7 @@ const api_1 = require("../api");
5
5
  const apiv2_1 = require("../apiv2");
6
6
  const utils = require("../utils");
7
7
  const API_VERSION = "v1";
8
- const client = new apiv2_1.Client({ urlPrefix: api_1.cloudbillingOrigin, apiVersion: API_VERSION });
8
+ const client = new apiv2_1.Client({ urlPrefix: (0, api_1.cloudbillingOrigin)(), apiVersion: API_VERSION });
9
9
  async function checkBillingEnabled(projectId) {
10
10
  const res = await client.get(utils.endpoint(["projects", projectId, "billingInfo"]), { retryCodes: [500, 503] });
11
11
  return res.body.billingEnabled;
@@ -5,7 +5,7 @@ const apiv2_1 = require("../apiv2");
5
5
  const api_1 = require("../api");
6
6
  const PAGE_SIZE_MAX = 100;
7
7
  const client = new apiv2_1.Client({
8
- urlPrefix: api_1.cloudbuildOrigin,
8
+ urlPrefix: (0, api_1.cloudbuildOrigin)(),
9
9
  auth: true,
10
10
  apiVersion: "v2",
11
11
  });
@@ -13,7 +13,7 @@ const apiv2_1 = require("../apiv2");
13
13
  const api_1 = require("../api");
14
14
  const constants_1 = require("../functions/constants");
15
15
  exports.API_VERSION = "v1";
16
- const client = new apiv2_1.Client({ urlPrefix: api_1.functionsOrigin, apiVersion: exports.API_VERSION });
16
+ const client = new apiv2_1.Client({ urlPrefix: (0, api_1.functionsOrigin)(), apiVersion: exports.API_VERSION });
17
17
  function functionsOpLogReject(funcName, type, err) {
18
18
  var _a, _b, _c, _d;
19
19
  if (((_b = (_a = err === null || err === void 0 ? void 0 : err.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode) === 429) {
@@ -15,7 +15,7 @@ const constants_1 = require("../functions/constants");
15
15
  exports.API_VERSION = "v2";
16
16
  const DEFAULT_MAX_INSTANCE_COUNT = 100;
17
17
  const client = new apiv2_1.Client({
18
- urlPrefix: api_1.functionsV2Origin,
18
+ urlPrefix: (0, api_1.functionsV2Origin)(),
19
19
  auth: true,
20
20
  apiVersion: exports.API_VERSION,
21
21
  });
@@ -6,7 +6,7 @@ const apiv2_1 = require("../apiv2");
6
6
  const error_1 = require("../error");
7
7
  const API_VERSION = "v2";
8
8
  async function listEntries(projectId, filter, pageSize, order) {
9
- const client = new apiv2_1.Client({ urlPrefix: api_1.cloudloggingOrigin, apiVersion: API_VERSION });
9
+ const client = new apiv2_1.Client({ urlPrefix: (0, api_1.cloudloggingOrigin)(), apiVersion: API_VERSION });
10
10
  try {
11
11
  const result = await client.post("/entries:list", {
12
12
  resourceNames: [`projects/${projectId}`],
@@ -59,7 +59,7 @@ var ValueType;
59
59
  })(ValueType = exports.ValueType || (exports.ValueType = {}));
60
60
  async function queryTimeSeries(query, projectNumber) {
61
61
  const client = new apiv2_1.Client({
62
- urlPrefix: api_1.cloudMonitoringOrigin,
62
+ urlPrefix: (0, api_1.cloudMonitoringOrigin)(),
63
63
  apiVersion: exports.CLOUD_MONITORING_VERSION,
64
64
  });
65
65
  try {
@@ -13,7 +13,7 @@ const functional_1 = require("../functional");
13
13
  const VERSION = "v1";
14
14
  const DEFAULT_TIME_ZONE_V1 = "America/Los_Angeles";
15
15
  const DEFAULT_TIME_ZONE_V2 = "UTC";
16
- const apiClient = new apiv2_1.Client({ urlPrefix: api_1.cloudschedulerOrigin, apiVersion: VERSION });
16
+ const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.cloudschedulerOrigin)(), apiVersion: VERSION });
17
17
  function createJob(job) {
18
18
  const strippedName = job.name.substring(0, job.name.lastIndexOf("/"));
19
19
  const json = job.pubsubTarget
@@ -7,7 +7,7 @@ const api_1 = require("../api");
7
7
  const functional_1 = require("../functional");
8
8
  const API_VERSION = "v2";
9
9
  const client = new apiv2_1.Client({
10
- urlPrefix: api_1.cloudTasksOrigin,
10
+ urlPrefix: (0, api_1.cloudTasksOrigin)(),
11
11
  auth: true,
12
12
  apiVersion: API_VERSION,
13
13
  });
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serviceAgentEmail = exports.getGitRepositoryLink = exports.createGitRepositoryLink = exports.listAllLinkableGitRepositories = exports.listAllConnections = exports.getConnection = exports.createConnection = exports.client = void 0;
4
+ const apiv2_1 = require("../apiv2");
5
+ const api_1 = require("../api");
6
+ const PAGE_SIZE_MAX = 1000;
7
+ exports.client = new apiv2_1.Client({
8
+ urlPrefix: (0, api_1.developerConnectOrigin)(),
9
+ auth: true,
10
+ apiVersion: "v1",
11
+ });
12
+ async function createConnection(projectId, location, connectionId, githubConfig) {
13
+ const config = Object.assign(Object.assign({}, githubConfig), { githubApp: "FIREBASE" });
14
+ const res = await exports.client.post(`projects/${projectId}/locations/${location}/connections`, {
15
+ githubConfig: config,
16
+ }, { queryParams: { connectionId } });
17
+ return res.body;
18
+ }
19
+ exports.createConnection = createConnection;
20
+ async function getConnection(projectId, location, connectionId) {
21
+ const name = `projects/${projectId}/locations/${location}/connections/${connectionId}`;
22
+ const res = await exports.client.get(name);
23
+ return res.body;
24
+ }
25
+ exports.getConnection = getConnection;
26
+ async function listAllConnections(projectId, location) {
27
+ const conns = [];
28
+ const getNextPage = async (pageToken = "") => {
29
+ const res = await exports.client.get(`/projects/${projectId}/locations/${location}/connections`, {
30
+ queryParams: {
31
+ pageSize: PAGE_SIZE_MAX,
32
+ pageToken,
33
+ },
34
+ });
35
+ if (Array.isArray(res.body.connections)) {
36
+ conns.push(...res.body.connections);
37
+ }
38
+ if (res.body.nextPageToken) {
39
+ await getNextPage(res.body.nextPageToken);
40
+ }
41
+ };
42
+ await getNextPage();
43
+ return conns;
44
+ }
45
+ exports.listAllConnections = listAllConnections;
46
+ async function listAllLinkableGitRepositories(projectId, location, connectionId) {
47
+ const name = `projects/${projectId}/locations/${location}/connections/${connectionId}:fetchLinkableRepositories`;
48
+ const repos = [];
49
+ const getNextPage = async (pageToken = "") => {
50
+ const res = await exports.client.get(name, {
51
+ queryParams: {
52
+ PAGE_SIZE_MAX,
53
+ pageToken,
54
+ },
55
+ });
56
+ if (Array.isArray(res.body.repositories)) {
57
+ repos.push(...res.body.repositories);
58
+ }
59
+ if (res.body.nextPageToken) {
60
+ await getNextPage(res.body.nextPageToken);
61
+ }
62
+ };
63
+ await getNextPage();
64
+ return repos;
65
+ }
66
+ exports.listAllLinkableGitRepositories = listAllLinkableGitRepositories;
67
+ async function createGitRepositoryLink(projectId, location, connectionId, gitRepositoryLinkId, cloneUri) {
68
+ const res = await exports.client.post(`projects/${projectId}/locations/${location}/connections/${connectionId}/gitRepositoryLinks`, { cloneUri }, { queryParams: { gitRepositoryLinkId } });
69
+ return res.body;
70
+ }
71
+ exports.createGitRepositoryLink = createGitRepositoryLink;
72
+ async function getGitRepositoryLink(projectId, location, connectionId, gitRepositoryLinkId) {
73
+ const name = `projects/${projectId}/locations/${location}/connections/${connectionId}/gitRepositoryLinks/${gitRepositoryLinkId}`;
74
+ const res = await exports.client.get(name);
75
+ return res.body;
76
+ }
77
+ exports.getGitRepositoryLink = getGitRepositoryLink;
78
+ function serviceAgentEmail(projectNumber) {
79
+ return `service-${projectNumber}@${(0, api_1.developerConnectP4SAOrigin)()}`;
80
+ }
81
+ exports.serviceAgentEmail = serviceAgentEmail;
@@ -7,7 +7,7 @@ const lodash_1 = require("lodash");
7
7
  const proto_1 = require("./proto");
8
8
  exports.API_VERSION = "v1";
9
9
  const client = new apiv2_1.Client({
10
- urlPrefix: api_1.eventarcOrigin,
10
+ urlPrefix: (0, api_1.eventarcOrigin)(),
11
11
  auth: true,
12
12
  apiVersion: exports.API_VERSION,
13
13
  });