@jinshuju/cli 0.6.0 → 0.7.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.
package/README.md CHANGED
@@ -138,6 +138,9 @@ jinshuju entry list --form Kp7mQ2 --all
138
138
  `--limit` can only ask for less: a listing's default page size is also its
139
139
  maximum (50 in most cases), and anything larger is capped.
140
140
 
141
+ `--all` reads at most 200 pages. Past that it stops with an error naming the
142
+ cursor; pass it to `--next` (with `--all` again) to read on.
143
+
141
144
  `--filter` is repeatable and the conditions are AND-combined. For conditions it
142
145
  cannot express, use `--filters <json|@file>`. Cursors are opaque strings — pass
143
146
  the `next` value from the previous response back verbatim.
package/dist/cli.js CHANGED
@@ -84,10 +84,10 @@ async function runRemote(command, words, flags, runtime, stdin) {
84
84
  return ok(format(selected, output, width, hints));
85
85
  }
86
86
  /**
87
- * More pages than any listing has. A cursor that never runs out would
88
- * otherwise read forever; stopping here says so instead, with what was read.
87
+ * The most pages one `--all` reads. Past it the listing goes on with `--next`,
88
+ * and a cursor that never runs out cannot read forever.
89
89
  */
90
- const MAX_PAGES = 10_000;
90
+ const MAX_PAGES = 200;
91
91
  /**
92
92
  * Every page of a listing, handed on a page at a time. A cursor is opaque: it
93
93
  * goes back exactly as it came. Answers how many rows there were.
@@ -113,9 +113,9 @@ async function readAllPages(client, request, paginate, watching, onPage) {
113
113
  if (String(next) === cursor) {
114
114
  throw new HttpError(`the server answered page ${page} with the cursor it was asked for; stopping rather than looping`, 200, body);
115
115
  }
116
- if (page >= MAX_PAGES)
117
- throw new Error(`stopped after ${MAX_PAGES} pages and ${count} rows; the listing has no end`);
118
116
  cursor = String(next);
117
+ if (page >= MAX_PAGES)
118
+ throw new Error(`stopped after ${MAX_PAGES} pages and ${count} rows; carry on with --next ${cursor}`);
119
119
  }
120
120
  watching.done();
121
121
  return count;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinshuju/cli",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Command line interface for Jinshuju Open API v1",
5
5
  "homepage": "https://github.com/jinshuju/cli#readme",
6
6
  "bugs": {