@stndrds/cli 1.0.0-alpha.142 → 1.0.0-alpha.145

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.
Files changed (2) hide show
  1. package/dist/bin.mjs +13 -13
  2. package/package.json +1 -1
package/dist/bin.mjs CHANGED
@@ -277,18 +277,18 @@ function registerKeysCommand(program) {
277
277
  // src/commands/records.ts
278
278
  function parseSortFlag(sort) {
279
279
  const [attribute, direction = "asc"] = sort.split(":");
280
- return JSON.stringify([{ attribute, direction }]);
280
+ return [{ attribute, direction }];
281
281
  }
282
282
  function registerRecordsCommand(program) {
283
283
  const records = program.command("records").description("Manage records (CRUD + search)");
284
284
  records.command("list").description("List records for an object").argument("<object>", "object name (e.g. contacts)").option("--limit <n>", "max records to return").option("--offset <n>", "number of records to skip").option("--sort <sort>", 'sort rule as "attribute:direction"').option("--filter <json>", "filter state as JSON string").action(async (objectName, opts, cmd) => {
285
285
  const client = getClientFromCommand(cmd);
286
- const params = {};
287
- if (opts.limit) params.limit = opts.limit;
288
- if (opts.offset) params.offset = opts.offset;
289
- if (opts.sort) params.sorts = parseSortFlag(opts.sort);
290
- if (opts.filter) params.filters = opts.filter;
291
- const result = await client.get(`/records/${objectName}`, params);
286
+ const body = {};
287
+ if (opts.limit) body.limit = Number(opts.limit);
288
+ if (opts.offset) body.offset = Number(opts.offset);
289
+ if (opts.sort) body.sorts = parseSortFlag(opts.sort);
290
+ if (opts.filter) body.filters = JSON.parse(opts.filter);
291
+ const result = await client.post(`/records/${objectName}/list`, body);
292
292
  formatOutput(result, getFormat(cmd));
293
293
  });
294
294
  records.command("get").description("Get a record by ID").argument("<object>", "object name").argument("<id>", "record ID").action(async (objectName, id, _opts, cmd) => {
@@ -316,12 +316,12 @@ function registerRecordsCommand(program) {
316
316
  });
317
317
  records.command("search").description("Full-text search records").argument("<object>", "object name").requiredOption("--query <q>", "search query string").option("--limit <n>", "max records to return").option("--offset <n>", "number of records to skip").option("--sort <sort>", 'sort rule as "attribute:direction"').option("--filter <json>", "filter state as JSON string").action(async (objectName, opts, cmd) => {
318
318
  const client = getClientFromCommand(cmd);
319
- const params = { q: opts.query };
320
- if (opts.limit) params.limit = opts.limit;
321
- if (opts.offset) params.offset = opts.offset;
322
- if (opts.sort) params.sorts = parseSortFlag(opts.sort);
323
- if (opts.filter) params.filters = opts.filter;
324
- const result = await client.get(`/records/${objectName}/search`, params);
319
+ const body = { q: opts.query };
320
+ if (opts.limit) body.limit = Number(opts.limit);
321
+ if (opts.offset) body.offset = Number(opts.offset);
322
+ if (opts.sort) body.sorts = parseSortFlag(opts.sort);
323
+ if (opts.filter) body.filters = JSON.parse(opts.filter);
324
+ const result = await client.post(`/records/${objectName}/search`, body);
325
325
  formatOutput(result, getFormat(cmd));
326
326
  });
327
327
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stndrds/cli",
3
- "version": "1.0.0-alpha.142",
3
+ "version": "1.0.0-alpha.145",
4
4
  "description": "CLI tool to interact with Standards API",
5
5
  "type": "module",
6
6
  "bin": {