@apex-actions/cli 0.81.0 → 0.83.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.
@@ -403,8 +403,27 @@ export class HttpControlPlane {
403
403
  async listRunArtifacts(runId) {
404
404
  return await this.#json('GET', `/api/v1/runs/${encodeURIComponent(runId)}/artifacts`);
405
405
  }
406
+ /**
407
+ * Every artifact a repository holds. The list is paged since control-plane ADR-0081 (context TASK-0228), so this
408
+ * follows `page.nextCursor` to the end; before, the list stopped at 200 without saying so. The total is the API's,
409
+ * over every artifact. A control plane from before the grammar answers one page and no `page`, which ends the loop.
410
+ */
406
411
  async listRepoArtifacts(owner, repo) {
407
- return await this.#json('GET', `/api/v1/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/artifacts`);
412
+ const artifacts = [];
413
+ let totalSizeBytes = 0;
414
+ let cursor;
415
+ for (let pages = 0; pages < 100; pages++) {
416
+ const query = new URLSearchParams({ limit: '200' });
417
+ if (cursor !== undefined)
418
+ query.set('cursor', cursor);
419
+ const body = await this.#json('GET', `/api/v1/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/artifacts?${query.toString()}`);
420
+ artifacts.push(...body.artifacts);
421
+ totalSizeBytes = body.totalSizeBytes;
422
+ cursor = body.page?.nextCursor;
423
+ if (cursor === undefined)
424
+ break;
425
+ }
426
+ return { artifacts, totalSizeBytes };
408
427
  }
409
428
  /**
410
429
  * The API answers with a 302 to a presigned object URL. `fetch` follows it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apex-actions/cli",
3
- "version": "0.81.0",
3
+ "version": "0.83.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "//files": "Without this npm ships src, test and the CI config alongside the binary a user installs.",
6
6
  "files": [