norns-sdk 0.4.0 → 0.4.1

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/index.d.cts CHANGED
@@ -241,8 +241,9 @@ declare class NornsClient {
241
241
  * console.log(run.id, run.waitingFor?.question);
242
242
  * }
243
243
  *
244
- * `status` and `agentId` filter the page the server returned, so a
245
- * narrow filter over a busy tenant may need a larger `limit`.
244
+ * `status` and `agentId` are sent to the server, which filters before
245
+ * applying `limit`. (A Norns older than the filters ignores them, so
246
+ * the page is filtered here as well.)
246
247
  */
247
248
  list: (options?: ListRunsOptions) => Promise<Run[]>;
248
249
  events: (runId: number) => Promise<RunEvent[]>;
package/dist/index.d.ts CHANGED
@@ -241,8 +241,9 @@ declare class NornsClient {
241
241
  * console.log(run.id, run.waitingFor?.question);
242
242
  * }
243
243
  *
244
- * `status` and `agentId` filter the page the server returned, so a
245
- * narrow filter over a busy tenant may need a larger `limit`.
244
+ * `status` and `agentId` are sent to the server, which filters before
245
+ * applying `limit`. (A Norns older than the filters ignores them, so
246
+ * the page is filtered here as well.)
246
247
  */
247
248
  list: (options?: ListRunsOptions) => Promise<Run[]>;
248
249
  events: (runId: number) => Promise<RunEvent[]>;
package/dist/index.js CHANGED
@@ -352,12 +352,16 @@ var NornsClient = class {
352
352
  * console.log(run.id, run.waitingFor?.question);
353
353
  * }
354
354
  *
355
- * `status` and `agentId` filter the page the server returned, so a
356
- * narrow filter over a busy tenant may need a larger `limit`.
355
+ * `status` and `agentId` are sent to the server, which filters before
356
+ * applying `limit`. (A Norns older than the filters ignores them, so
357
+ * the page is filtered here as well.)
357
358
  */
358
359
  list: async (options = {}) => {
360
+ const query = { limit: options.limit ?? 50 };
361
+ if (options.status) query.status = options.status;
362
+ if (options.agentId !== void 0) query.agent_id = options.agentId;
359
363
  const res = await this.#request("GET", "/api/v1/runs", {
360
- query: { limit: options.limit ?? 50 }
364
+ query
361
365
  });
362
366
  let runs = res.data.map(parseRun);
363
367
  if (options.status) runs = runs.filter((r) => r.status === options.status);