@kolatts/pncli 4.1.0 → 4.1.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.
package/dist/cli.js CHANGED
@@ -9463,19 +9463,28 @@ var AdoGitClient = class {
9463
9463
  }
9464
9464
  // ── Pull Requests ─────────────────────────────────────────────────
9465
9465
  async listPRs(collection, project, repo, opts = {}) {
9466
- return this.http.adoPaginate(async (token) => {
9466
+ const pageSize = 100;
9467
+ const results = [];
9468
+ let skip = 0;
9469
+ while (true) {
9467
9470
  const params = {
9468
9471
  "api-version": API7,
9469
9472
  "searchCriteria.status": opts.status ?? "active",
9470
9473
  ...opts.creatorAlias ? { "searchCriteria.creatorId": opts.creatorAlias } : {},
9471
9474
  ...opts.reviewerAlias ? { "searchCriteria.reviewerId": opts.reviewerAlias } : {},
9472
- ...token ? { continuationToken: token } : {}
9475
+ "$top": pageSize,
9476
+ "$skip": skip
9473
9477
  };
9474
- return this.http.adoRaw(
9478
+ const { data } = await this.http.adoRaw(
9475
9479
  `/${encodeURIComponent(collection)}/${encodeURIComponent(project)}/_apis/git/repositories/${encodeURIComponent(repo)}/pullrequests`,
9476
9480
  { params }
9477
9481
  );
9478
- });
9482
+ const page = data.value ?? [];
9483
+ results.push(...page);
9484
+ if (page.length < pageSize) break;
9485
+ skip += pageSize;
9486
+ }
9487
+ return results;
9479
9488
  }
9480
9489
  async getPR(collection, project, repo, prId) {
9481
9490
  return this.http.ado(
@@ -11372,14 +11381,27 @@ function registerContrastCommands(program2) {
11372
11381
  fail(err, "contrast", "libraries list", start);
11373
11382
  }
11374
11383
  });
11375
- libraries.command("get").description("Get details for a specific library used by an application").requiredOption("--app <app-id>", "Application ID (UUID)").requiredOption("--hash <library-hash>", "Library hash").action(async (opts) => {
11384
+ libraries.command("get").description("Get details for a specific library used by an application, by hash").requiredOption("--app <app-id>", "Application ID (UUID)").requiredOption("--hash <library-hash>", "Library hash").action(async (opts) => {
11376
11385
  const start = Date.now();
11377
11386
  try {
11378
11387
  const { http, orgUuid } = getHttpAndOrg(program2);
11379
- const data = await http.contrast(
11380
- `/Contrast/api/ng/${orgUuid}/applications/${opts.app}/libraries/${opts.hash}`
11381
- );
11382
- success(data, "contrast", "libraries get", start);
11388
+ const batchSize = 25;
11389
+ let offset = 0;
11390
+ let match;
11391
+ for (; ; ) {
11392
+ const page = await http.contrast(
11393
+ `/Contrast/api/ng/${orgUuid}/applications/${opts.app}/libraries`,
11394
+ { params: { limit: batchSize, offset } }
11395
+ );
11396
+ const items = page.libraries ?? [];
11397
+ match = items.find((item) => item["hash"] === opts.hash);
11398
+ if (match || items.length < batchSize) break;
11399
+ offset += batchSize;
11400
+ }
11401
+ if (!match) {
11402
+ throw new PncliError(`Library with hash "${opts.hash}" not found for application ${opts.app}`, 404);
11403
+ }
11404
+ success(match, "contrast", "libraries get", start);
11383
11405
  } catch (err) {
11384
11406
  fail(err, "contrast", "libraries get", start);
11385
11407
  }