@crombolo/data 0.14.4 → 0.15.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crombolo/data",
3
- "version": "0.14.4",
3
+ "version": "0.15.0",
4
4
  "description": "SQLite and Postgres storage for crombolo: schema, migrations and repositories.",
5
5
  "license": "MIT",
6
6
  "author": "Crombolo",
@@ -28,6 +28,6 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@crombolo/core": "0.14.4"
31
+ "@crombolo/core": "0.15.0"
32
32
  }
33
33
  }
@@ -138,14 +138,19 @@ export class TransferRunRepository {
138
138
  }
139
139
 
140
140
  /** Runs, newest first. */
141
- async recent(limit = 20): Promise<TransferRun[]> {
141
+ async recent(limit = 20, offset = 0): Promise<TransferRun[]> {
142
142
  const rows = await this.#db.query(
143
- 'SELECT * FROM content_transfer_run ORDER BY started_at DESC, id DESC LIMIT ?',
144
- [limit],
143
+ 'SELECT * FROM content_transfer_run ORDER BY started_at DESC, id DESC LIMIT ? OFFSET ?',
144
+ [limit, offset],
145
145
  )
146
146
  return rows.map(mapRun)
147
147
  }
148
148
 
149
+ async count(): Promise<number> {
150
+ const rows = await this.#db.query('SELECT COUNT(*) AS n FROM content_transfer_run')
151
+ return Number(rows[0]?.n ?? 0)
152
+ }
153
+
149
154
  async changes(runId: string): Promise<TransferChange[]> {
150
155
  const rows = await this.#db.query(
151
156
  'SELECT * FROM content_transfer_change WHERE run_id = ? ORDER BY id',