@basementuniverse/jsonpad-cli 1.6.0 → 1.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/CHANGELOG.md CHANGED
@@ -7,7 +7,31 @@ and this package adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  Dates are npm publish dates.
9
9
 
10
- ## [Unreleased]
10
+ ## [1.7.0] - 2026-12-03
11
+
12
+ Needs `@basementuniverse/jsonpad-sdk` 3.0, `@basementuniverse/jsonpad-realtime-sdk`
13
+ 2.0 and `@basementuniverse/jsonpad-rules` 1.3.
14
+
15
+ ### Added
16
+
17
+ - **`lists search` takes `--where`, `--alias`, `--tagged`, `--page` and
18
+ `--limit`**, like `items list`, e.g. `jsonpad lists search events jazz
19
+ --where starts=after:2026-12-03 --where category=eq:music`. As a table, it
20
+ shows the page and total underneath. JSON output is still an array of
21
+ results.
22
+
23
+ ### Changed
24
+
25
+ - `--where` help mentions the `eq:` prefix, which matches the whole value of a
26
+ string index (the API from 2026-12; without it, a string filter matches
27
+ anywhere in the value).
28
+ - Uses SDK 3.0 and realtime SDK 2.0, which have ES module builds, so the CLI
29
+ imports their classes directly. API error messages come from the SDK's
30
+ `apiMessage` (in 3.0, `error.message` is no longer the raw response body).
31
+ - Write rules are checked with rules engine 1.3, which knows
32
+ `permissions decide <operations>;`.
33
+
34
+ ## [1.6.0] - 2026-09-27
11
35
 
12
36
  Needs `@basementuniverse/jsonpad-sdk` with `runFlow()` (the release after
13
37
  2.2.0), and the JSONPad API release with flows. `package.json` points at the
package/REFERENCE.md CHANGED
@@ -338,6 +338,11 @@ jsonpad lists search [options] <list> <query>
338
338
  | `--include-items` | Include the items, not just their ids |
339
339
  | `--include-data` | With --include-items, include each item's data |
340
340
  | `--include-guarded` | Include guarded values in the item data, for items the identity making the request owns |
341
+ | `--where <index=value>` | Only search items whose indexed value matches, e.g. --where starts=after:2026-12-03 or --where category=eq:music (repeatable; the index must allow filtering) |
342
+ | `--alias <value>` | Only search items whose alias contains this |
343
+ | `--tagged <tags>` | Only search items with one of these comma-separated tags (repeat the option to require every group) |
344
+ | `--page <number>` | The page of results to fetch (default 1) |
345
+ | `--limit <number>` | How many results per page, up to 100 (default 10) |
341
346
  | `-o, --output <format>` | Output format (default: table in a terminal, otherwise json) (one of: table, json, ndjson, id) |
342
347
  | `--json` | Output JSON (the same as --output json) |
343
348
  | `-q, --quiet` | Only output ids (the same as --output id) |
@@ -715,7 +720,7 @@ jsonpad items list [options] <list>
715
720
 
716
721
  | Option | Description |
717
722
  | --- | --- |
718
- | `--where <index=value>` | Only items whose indexed value matches, e.g. --where title=Pancakes (repeatable; the index must allow filtering) |
723
+ | `--where <index=value>` | Only items whose indexed value matches, e.g. --where title=Pancakes (anywhere in the value), --where category=eq:breakfast (the whole value) or --where serves=gte:4 (repeatable; the index must allow filtering) |
719
724
  | `--alias <value>` | Only the item with this alias |
720
725
  | `--identity-id <id>` | Only items owned by this identity |
721
726
  | `--readonly` | Only readonly items |
@@ -77,7 +77,7 @@ export function defineItems(command, context) {
77
77
  .alias('ls')
78
78
  .description("List a list's items (the default when no command is given)")
79
79
  .argument('<list>', 'The list (id or path name)')
80
- .option('--where <index=value>', 'Only items whose indexed value matches, e.g. --where title=Pancakes (repeatable; the index must allow filtering)', (value, previous = []) => [...previous, value])
80
+ .option('--where <index=value>', 'Only items whose indexed value matches, e.g. --where title=Pancakes (anywhere in the value), --where category=eq:breakfast (the whole value) or --where serves=gte:4 (repeatable; the index must allow filtering)', (value, previous = []) => [...previous, value])
81
81
  .option('--alias <value>', 'Only the item with this alias')
82
82
  .option('--identity-id <id>', 'Only items owned by this identity');
83
83
  addBooleanOption(list, 'readonly', 'Only readonly items', "Only items that aren't readonly");
@@ -4,8 +4,9 @@ import { CliError } from '../errors.js';
4
4
  import { canPrompt, confirm, readJsonInput, readStdin } from '../input.js';
5
5
  import { compileRules, readJsonFile, readTextFile, runRuleTests, } from '../rules.js';
6
6
  import { addOutputOptions, formatFlags, formatNumber, formatTimestamp, printRecord, printRecords, resolveOutputFormat, } from '../output.js';
7
- import { addBooleanOption, addAllOption, addPagingOptions, addTaggedOption, addTagsOption, nullable, readBody, removeUndefined, printPages, request, } from '../resources.js';
7
+ import { addBooleanOption, addAllOption, addPagingOptions, addTaggedOption, addTagsOption, nullable, parseLimit, parsePositiveInteger, readBody, removeUndefined, printPages, request, } from '../resources.js';
8
8
  import { defineEventCommands, defineStatsCommand } from './history.js';
9
+ import { whereParameters } from './items.js';
9
10
  const FLAGS = [
10
11
  'pinned',
11
12
  'readonly',
@@ -298,18 +299,33 @@ export function defineLists(command, context) {
298
299
  .argument('<query>', 'What to search for, 3 to 100 characters')
299
300
  .option('--include-items', 'Include the items, not just their ids')
300
301
  .option('--include-data', "With --include-items, include each item's data")
301
- .option('--include-guarded', 'Include guarded values in the item data, for items the identity making the request owns')).action(async (listId, query, options) => {
302
+ .option('--include-guarded', 'Include guarded values in the item data, for items the identity making the request owns')
303
+ .option('--where <index=value>', 'Only search items whose indexed value matches, e.g. --where starts=after:2026-12-03 or --where category=eq:music (repeatable; the index must allow filtering)', (value, previous = []) => [...previous, value])
304
+ .option('--alias <value>', 'Only search items whose alias contains this')
305
+ .option('--tagged <tags>', 'Only search items with one of these comma-separated tags (repeat the option to require every group)', (value, previous = []) => [...previous, value])
306
+ .option('--page <number>', 'The page of results to fetch (default 1)', parsePositiveInteger)
307
+ .option('--limit <number>', 'How many results per page, up to 100 (default 10)', parseLimit)).action(async (listId, query, options) => {
302
308
  const format = resolveOutputFormat(context, options);
303
309
  // The API's own error for this is a raw validation error
304
310
  if (query.length < 3 || query.length > 100) {
305
311
  throw new CliError('The search query must be from 3 to 100 characters long');
306
312
  }
313
+ const where = whereParameters(options.where);
307
314
  const jsonpad = context.createClient();
308
315
  const results = await request(context, () => jsonpad.searchList(listId, query, removeUndefined({
316
+ ...where,
309
317
  includeItems: options.includeItems,
310
318
  includeData: options.includeData,
311
319
  includeGuarded: options.includeGuarded,
320
+ alias: options.alias,
321
+ tagged: options.tagged,
322
+ page: options.page,
323
+ limit: options.limit,
312
324
  })));
325
+ // The results are a plain array; the totals come in headers, which the
326
+ // SDK reads into lastResponse
327
+ const total = jsonpad.lastResponse?.total ?? null;
328
+ const pages = jsonpad.lastResponse?.pages ?? null;
313
329
  const idOf = (result) => 'item' in result ? result.item.id : result.id;
314
330
  printRecords(context, format, results, {
315
331
  id: idOf,
@@ -330,6 +346,9 @@ export function defineLists(command, context) {
330
346
  ],
331
347
  empty: 'Nothing found',
332
348
  });
349
+ if (format === 'table' && total !== null && total > 0) {
350
+ context.error(context.colours.dim(`page ${options.page ?? 1} of ${Math.max(1, pages ?? 1)} (${formatNumber(total)} total)`));
351
+ }
333
352
  });
334
353
  defineListRules(command.command('rules'), context);
335
354
  const target = {
package/build/errors.js CHANGED
@@ -40,8 +40,14 @@ export class CliError extends Error {
40
40
  */
41
41
  export function describeApiError(error) {
42
42
  if (error instanceof JSONPadError) {
43
+ if (error.apiMessage) {
44
+ return error.apiMessage;
45
+ }
46
+ // A JSON body without a message is shown as it is; anything else (an HTML
47
+ // error page from a proxy, say) isn't worth showing
43
48
  try {
44
- return JSON.parse(error.message).message || error.message;
49
+ JSON.parse(error.body);
50
+ return error.body;
45
51
  }
46
52
  catch {
47
53
  return `The API responded with status ${error.status}`;
package/build/realtime.js CHANGED
@@ -1,7 +1,9 @@
1
- import realtime from '@basementuniverse/jsonpad-realtime-sdk';
2
- // The realtime SDK's Node build is CommonJS, so an ES module only sees its
3
- // exports object as the default import
4
- export const JSONPadRealtime = realtime.default;
1
+ export { RealtimeErrorEvent } from '@basementuniverse/jsonpad-realtime-sdk';
2
+ // Since 2.0 the realtime SDK has an ES module build, so its class is the
3
+ // default export (in 1.x, Node loaded it as CommonJS and an ES module only saw
4
+ // its exports object as the default import)
5
+ import JSONPadRealtime from '@basementuniverse/jsonpad-realtime-sdk';
6
+ export { JSONPadRealtime };
5
7
  export const REALTIME_EVENT_TYPES = [
6
8
  'list-created',
7
9
  'list-updated',
@@ -10,7 +10,7 @@ function parsePositiveInteger(value) {
10
10
  }
11
11
  return number;
12
12
  }
13
- function parseLimit(value) {
13
+ export function parseLimit(value) {
14
14
  const number = parsePositiveInteger(value);
15
15
  if (number > MAX_PAGE_SIZE) {
16
16
  throw new InvalidArgumentError(`Must be ${MAX_PAGE_SIZE} or less.`);
package/build/sdk.js CHANGED
@@ -1,5 +1,3 @@
1
- import sdk from '@basementuniverse/jsonpad-sdk';
2
- // The SDK is a UMD build, which Node loads as CommonJS, so an ES module only
3
- // sees its exports object as the default import
4
- export const JSONPad = sdk.default;
5
- export const { FlowError, IndexBuildError, JSONPadError, WriteRuleError } = sdk;
1
+ export { FlowError, IndexBuildError, JSONPadError, WriteRuleError, } from '@basementuniverse/jsonpad-sdk';
2
+ // Since SDK 3.0, the default import is the JSONPad class in ES modules too
3
+ export { default as JSONPad } from '@basementuniverse/jsonpad-sdk';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basementuniverse/jsonpad-cli",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Command line tool for JSONPad",
5
5
  "author": "Gordon Larrigan <gordonlarrigan@gmail.com> (https://gordonlarrigan.com)",
6
6
  "license": "MIT",
@@ -39,9 +39,9 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@basementuniverse/jsonpad-flows": "1.0.0",
42
- "@basementuniverse/jsonpad-realtime-sdk": "^1.6.0",
43
- "@basementuniverse/jsonpad-rules": "^1.2.0",
44
- "@basementuniverse/jsonpad-sdk": "^2.3.0",
42
+ "@basementuniverse/jsonpad-realtime-sdk": "^2.0.0",
43
+ "@basementuniverse/jsonpad-rules": "^1.3.0",
44
+ "@basementuniverse/jsonpad-sdk": "^3.0.0",
45
45
  "commander": "^15.0.0"
46
46
  },
47
47
  "devDependencies": {