• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

u-wave / core / 19337142747

13 Nov 2025 03:43PM UTC coverage: 85.319%. First build
19337142747

Pull #657

github

web-flow
Merge 2ae249b03 into cc369fe03
Pull Request #657: Store waitlist and booth state in SQLite instead of Redis

954 of 1135 branches covered (84.05%)

Branch coverage included in aggregate %.

194 of 230 new or added lines in 7 files covered. (84.35%)

10047 of 11759 relevant lines covered (85.44%)

192.37 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.31
/src/KeyValue.js
1
import { fromJson, json, jsonb } from './utils/sqlite.js';
2✔
2

2✔
3
export default class KeyValue {
2✔
4
  #db;
298✔
5

298✔
6
  /** @param {import('./schema.js').Kysely} db */
298✔
7
  constructor(db) {
298✔
8
    this.#db = db;
298✔
9
  }
298✔
10

298✔
11
  /** @param {string} key */
298✔
12
  async get(key, db = this.#db) {
298✔
13
    const row = await db.selectFrom('keyval')
408✔
14
      .select((eb) => json(eb.ref('value')).as('value'))
408✔
15
      .where('key', '=', key)
408✔
16
      .executeTakeFirst();
408✔
17
    if (row == null) {
408✔
18
      return undefined;
138✔
19
    }
138✔
20
    return fromJson(row.value);
270✔
21
  }
408✔
22

298✔
23
  /**
298✔
24
   * @param {string} key
298✔
25
   * @param {import('type-fest').JsonValue} value
298✔
26
   */
298✔
27
  async set(key, value, db = this.#db) {
298✔
28
    await db.insertInto('keyval')
180✔
29
      .values({ key, value: jsonb(value) })
180✔
30
      .onConflict((oc) => oc.column('key').doUpdateSet({ value: jsonb(value) }))
180✔
31
      .execute();
180✔
32
  }
180✔
33

298✔
34
  /**
298✔
35
   * Delete a key, returning its previous value if any.
298✔
36
   *
298✔
37
   * @param {string} key
298✔
38
   * @returns {Promise<import('type-fest').JsonValue | undefined>}
298✔
39
   */
298✔
40
  async delete(key, db = this.#db) {
298✔
41
    const existing = await db.deleteFrom('keyval')
72✔
42
      .where('key', '=', key)
72✔
43
      .returning((eb) => json(eb.ref('value')).as('value'))
72✔
44
      .executeTakeFirst();
72✔
45

72✔
46
    if (existing == null) {
72✔
47
      return undefined;
72✔
48
    }
72✔
NEW
49

×
NEW
50
    return fromJson(existing.value);
×
51
  }
72✔
52
}
298✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc