@pipod/cli 0.1.16 → 0.1.17

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
@@ -14894,14 +14894,31 @@ import * as path22 from "path";
14894
14894
  var PAGE_LIMIT = 200;
14895
14895
  async function listAllPods(client, query) {
14896
14896
  const pods = [];
14897
+ const seenIds = /* @__PURE__ */ new Set();
14898
+ const seenCursors = /* @__PURE__ */ new Set();
14899
+ let cursor;
14897
14900
  let before;
14898
14901
  for (; ; ) {
14899
- const page = await client.listPods({ mine: true, limit: PAGE_LIMIT, before, ...query });
14900
- pods.push(...page.pods);
14901
- if (page.pods.length < PAGE_LIMIT) return { pods };
14902
- const cursor = activityStamp(page.pods.at(-1));
14903
- if (cursor === before) return { pods };
14904
- before = cursor;
14902
+ const page = await client.listPods({ mine: true, limit: PAGE_LIMIT, cursor, before, ...query });
14903
+ for (const pod of page.pods) {
14904
+ if (!seenIds.has(pod.id)) pods.push(pod);
14905
+ seenIds.add(pod.id);
14906
+ }
14907
+ const next = page.nextCursor !== void 0 ? page.nextCursor : page.pods.length < PAGE_LIMIT ? null : activityStamp(page.pods.at(-1));
14908
+ if (next === null) return { pods };
14909
+ if (seenCursors.has(next)) {
14910
+ throw new PiPodError("the server repeated a pod-list cursor", {
14911
+ hint: "the listing is incomplete; upgrade the server and try again"
14912
+ });
14913
+ }
14914
+ seenCursors.add(next);
14915
+ if (page.nextCursor !== void 0) {
14916
+ cursor = next;
14917
+ before = void 0;
14918
+ } else {
14919
+ before = next;
14920
+ cursor = void 0;
14921
+ }
14905
14922
  }
14906
14923
  }
14907
14924
  async function podsInScope(client, flags, cwd) {