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

snatalenko / node-cqrs / 21966362039

12 Feb 2026 10:15PM UTC coverage: 85.328% (-9.1%) from 94.396%
21966362039

Pull #28

github

web-flow
Merge 9adf24177 into 828e39903
Pull Request #28: TypeScript and event dispatching pipeline refactoring

671 of 1008 branches covered (66.57%)

927 of 1051 new or added lines in 67 files covered. (88.2%)

49 existing lines in 13 files now uncovered.

1262 of 1479 relevant lines covered (85.33%)

33.76 hits per line

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

64.71
/src/sqlite/SqliteObjectView.ts
1
import { AbstractSqliteView } from './AbstractSqliteView.ts';
8✔
2
import type { IObjectStorage, IEventLocker } from '../interfaces/index.ts';
3
import { SqliteObjectStorage } from './SqliteObjectStorage.ts';
8✔
4
import type { Database } from 'better-sqlite3';
5

6
/**
7
 * SQLite-backed object view with restore locking and last-processed-event tracking
8
 */
9
export class SqliteObjectView<TRecord> extends AbstractSqliteView implements IObjectStorage<TRecord>, IEventLocker {
8✔
10

11
        #sqliteObjectStorage: SqliteObjectStorage<TRecord>;
12

13
        constructor(options: ConstructorParameters<typeof AbstractSqliteView>[0] & {
14
                tableNamePrefix: string
15
        }) {
16
                if (typeof options.tableNamePrefix !== 'string' || !options.tableNamePrefix.length)
8!
NEW
17
                        throw new TypeError('tableNamePrefix argument must be a non-empty String');
×
18
                if (typeof options.schemaVersion !== 'string' || !options.schemaVersion.length)
8✔
NEW
19
                        throw new TypeError('schemaVersion argument must be a non-empty String');
×
20

21
                super(options);
8✔
22

23
                this.#sqliteObjectStorage = new SqliteObjectStorage<TRecord>({
8✔
24
                        viewModelSqliteDb: options.viewModelSqliteDb,
25
                        viewModelSqliteDbFactory: options.viewModelSqliteDbFactory,
26
                        tableName: `${options.tableNamePrefix}_${options.schemaVersion}`
27
                });
28
        }
29

30
        // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
31
        protected initialize(db: Database): Promise<void> | void {
32
                // No need to initialize the table here, it's done in SqliteObjectStorage
33
        }
34

35
        async get(id: string): Promise<TRecord | undefined> {
36
                if (!this.ready)
8✔
37
                        await this.once('ready');
2✔
38

39
                return this.#sqliteObjectStorage.get(id);
8✔
40
        }
41

42
        getSync(id: string) {
NEW
43
                return this.#sqliteObjectStorage.getSync(id);
×
44
        }
45

46
        async create(id: string, data: TRecord) {
47
                await this.#sqliteObjectStorage.create(id, data);
2✔
48
        }
49

50
        async update(id: string, update: (r: TRecord) => TRecord) {
NEW
51
                await this.#sqliteObjectStorage.update(id, update);
×
52
        }
53

54
        async updateEnforcingNew(id: string, update: (r?: TRecord) => TRecord) {
NEW
55
                await this.#sqliteObjectStorage.updateEnforcingNew(id, update);
×
56
        }
57

58
        async delete(id: string): Promise<boolean> {
NEW
59
                return this.#sqliteObjectStorage.delete(id);
×
60
        }
61
}
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

© 2026 Coveralls, Inc