vercel 30.1.2 → 30.2.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 (2) hide show
  1. package/dist/index.js +51 -38
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -225398,7 +225398,6 @@ const path_1 = __webpack_require__(85622);
225398
225398
  const chalk_1 = __importDefault(__webpack_require__(90877));
225399
225399
  const url_1 = __webpack_require__(78835);
225400
225400
  const box_1 = __importDefault(__webpack_require__(58587));
225401
- const sleep_1 = __importDefault(__webpack_require__(89507));
225402
225401
  const format_date_1 = __importDefault(__webpack_require__(738));
225403
225402
  const link_1 = __importDefault(__webpack_require__(39302));
225404
225403
  const logo_1 = __importDefault(__webpack_require__(66669));
@@ -225543,38 +225542,27 @@ async function main(client) {
225543
225542
  }
225544
225543
  // Fetch all the project's "READY" deployments with the pagination API
225545
225544
  let deployments = [];
225546
- let next = badDeployment.createdAt + 1;
225547
- do {
225548
- const query = new url_1.URLSearchParams();
225549
- query.set('projectId', projectId);
225550
- if (badDeployment.target) {
225551
- query.set('target', badDeployment.target);
225552
- }
225553
- query.set('limit', '100');
225554
- query.set('state', 'READY');
225555
- if (next) {
225556
- query.set('until', String(next));
225557
- }
225558
- const res = await client.fetch(`/v6/deployments?${query}`, {
225559
- accountId: badDeployment.ownerId,
225560
- });
225561
- next = res.pagination.next;
225562
- let newDeployments = res.deployments;
225545
+ const query = new url_1.URLSearchParams();
225546
+ query.set('projectId', projectId);
225547
+ if (badDeployment.target) {
225548
+ query.set('target', badDeployment.target);
225549
+ }
225550
+ query.set('state', 'READY');
225551
+ query.set('until', String(badDeployment.createdAt + 1));
225552
+ for await (const chunk of client.fetchPaginated(`/v6/deployments?${query}`, {
225553
+ accountId: badDeployment.ownerId,
225554
+ })) {
225555
+ let newDeployments = chunk.deployments;
225563
225556
  // If we have the "good" deployment in this chunk, then we're done
225564
225557
  for (let i = 0; i < newDeployments.length; i++) {
225565
225558
  if (newDeployments[i].url === good) {
225566
225559
  // grab all deployments up until the good one
225567
225560
  newDeployments = newDeployments.slice(0, i);
225568
- next = undefined;
225569
225561
  break;
225570
225562
  }
225571
225563
  }
225572
225564
  deployments = deployments.concat(newDeployments);
225573
- if (next) {
225574
- // Small sleep to avoid rate limiting
225575
- await (0, sleep_1.default)(100);
225576
- }
225577
- } while (next);
225565
+ }
225578
225566
  if (!deployments.length) {
225579
225567
  output.error('Cannot bisect because this project does not have any deployments');
225580
225568
  return 1;
@@ -236354,6 +236342,7 @@ const files_1 = __webpack_require__(48695);
236354
236342
  const promise_1 = __webpack_require__(60076);
236355
236343
  const errors_ts_1 = __webpack_require__(39240);
236356
236344
  const error_utils_1 = __webpack_require__(39799);
236345
+ const sleep_1 = __importDefault(__webpack_require__(89507));
236357
236346
  const isSAMLError = (v) => {
236358
236347
  return v && v.saml;
236359
236348
  };
@@ -236475,6 +236464,23 @@ class Client extends events_1.EventEmitter {
236475
236464
  return contentType.includes('application/json') ? res.json() : res;
236476
236465
  }, opts.retry);
236477
236466
  }
236467
+ async *fetchPaginated(url, opts) {
236468
+ const endpoint = typeof url === 'string' ? new url_1.URL(url, this.apiUrl) : new url_1.URL(url.href);
236469
+ if (!endpoint.searchParams.has('limit')) {
236470
+ endpoint.searchParams.set('limit', '100');
236471
+ }
236472
+ let next;
236473
+ do {
236474
+ if (next) {
236475
+ // Small sleep to avoid rate limiting
236476
+ await (0, sleep_1.default)(100);
236477
+ endpoint.searchParams.set('until', String(next));
236478
+ }
236479
+ const res = await this.fetch(endpoint.href, opts);
236480
+ yield res;
236481
+ next = res.pagination?.next;
236482
+ } while (next);
236483
+ }
236478
236484
  _createPromptModule() {
236479
236485
  this.prompt = inquirer_1.default.createPromptModule({
236480
236486
  input: this.stdin,
@@ -243301,10 +243307,7 @@ exports.createProxy = void 0;
243301
243307
  const http_1 = __webpack_require__(98605);
243302
243308
  const node_fetch_1 = __webpack_require__(91596);
243303
243309
  const node_utils_1 = __webpack_require__(56057);
243304
- const toHeaders = (0, node_utils_1.buildToHeaders)({
243305
- // @ts-expect-error - `node-fetch` Headers is missing `getAll()`
243306
- Headers: node_fetch_1.Headers,
243307
- });
243310
+ const toHeaders = (0, node_utils_1.buildToHeaders)({ Headers: node_fetch_1.Headers });
243308
243311
  function createProxy(client) {
243309
243312
  return (0, http_1.createServer)(async (req, res) => {
243310
243313
  try {
@@ -246126,24 +246129,34 @@ async function ensureRepoLink(client, cwd, yes = false) {
246126
246129
  }
246127
246130
  const repoUrl = remoteUrls[remoteName];
246128
246131
  output.spinner(`Fetching Projects for ${(0, link_2.default)(repoUrl)} under ${chalk_1.default.bold(org.slug)}…`);
246129
- // TODO: Add pagination to fetch all Projects
246130
- const query = new URLSearchParams({ repoUrl, limit: '100' });
246131
- const projects = await client.fetch(`/v2/projects?${query}`);
246132
+ let projects = [];
246133
+ const query = new URLSearchParams({ repoUrl });
246134
+ const projectsIterator = client.fetchPaginated(`/v9/projects?${query}`);
246135
+ let printedFound = false;
246136
+ for await (const chunk of projectsIterator) {
246137
+ projects = projects.concat(chunk.projects);
246138
+ if (!printedFound && projects.length > 0) {
246139
+ output.log(`${(0, pluralize_1.default)('Project', chunk.projects.length)} linked to ${(0, link_2.default)(repoUrl)} under ${chalk_1.default.bold(org.slug)}:`);
246140
+ printedFound = true;
246141
+ }
246142
+ for (const project of chunk.projects) {
246143
+ output.print(` * ${chalk_1.default.cyan(`${org.slug}/${project.name}\n`)}`);
246144
+ }
246145
+ if (chunk.pagination.next) {
246146
+ output.spinner(`Found ${chalk_1.default.bold(projects.length)} Projects…`, 0);
246147
+ }
246148
+ }
246132
246149
  if (projects.length === 0) {
246133
246150
  output.log(`No Projects are linked to ${(0, link_2.default)(repoUrl)} under ${chalk_1.default.bold(org.slug)}.`);
246134
246151
  // TODO: run detection logic to find potential projects.
246135
246152
  // then prompt user to select valid projects.
246136
246153
  // then create new Projects
246137
246154
  }
246138
- else {
246139
- output.log(`Found ${chalk_1.default.bold(projects.length)} ${(0, pluralize_1.default)('Project', projects.length)} linked to ${(0, link_2.default)(repoUrl)} under ${chalk_1.default.bold(org.slug)}:`);
246140
- }
246141
- for (const project of projects) {
246142
- output.print(` * ${chalk_1.default.cyan(`${org.slug}/${project.name}\n`)}`);
246143
- }
246144
246155
  shouldLink =
246145
246156
  yes ||
246146
- (await (0, confirm_1.default)(client, `Link to ${projects.length === 1 ? 'it' : 'them'}?`, true));
246157
+ (await (0, confirm_1.default)(client, `Link to ${projects.length === 1
246158
+ ? 'this Project'
246159
+ : `these ${chalk_1.default.bold(projects.length)} Projects`}?`, true));
246147
246160
  if (!shouldLink) {
246148
246161
  output.print(`Canceled. Repository not linked.\n`);
246149
246162
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vercel",
3
- "version": "30.1.2",
3
+ "version": "30.2.0",
4
4
  "preferGlobal": true,
5
5
  "license": "Apache-2.0",
6
6
  "description": "The command-line interface for Vercel",
@@ -26,12 +26,12 @@
26
26
  "@vercel/go": "2.5.1",
27
27
  "@vercel/hydrogen": "0.0.64",
28
28
  "@vercel/next": "3.8.6",
29
- "@vercel/node": "2.14.5",
29
+ "@vercel/node": "2.15.0",
30
30
  "@vercel/python": "3.1.60",
31
31
  "@vercel/redwood": "1.1.15",
32
- "@vercel/remix-builder": "1.8.12",
32
+ "@vercel/remix-builder": "1.8.13",
33
33
  "@vercel/ruby": "1.3.76",
34
- "@vercel/static-build": "1.3.34"
34
+ "@vercel/static-build": "1.3.35"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@alex_neo/jest-expect-message": "1.0.5",