Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ulixee
GitHub Repository: ulixee/secret-agent
Path: blob/main/core/models/PageLogsTable.ts
1028 views
1
import { Database as SqliteDatabase } from 'better-sqlite3';
2
import SqliteTable from '@secret-agent/commons/SqliteTable';
3
4
export default class PageLogsTable extends SqliteTable<IPageLogRecord> {
5
constructor(readonly db: SqliteDatabase) {
6
super(db, 'PageLogs', [
7
['tabId', 'INTEGER'],
8
['frameId', 'INTEGER'],
9
['type', 'TEXT'],
10
['message', 'TEXT'],
11
['timestamp', 'INTEGER'],
12
['location', 'TEXT'],
13
]);
14
}
15
16
public insert(
17
tabId: number,
18
frameId: number,
19
type: string,
20
message: string,
21
date: Date,
22
location?: string,
23
) {
24
return this.queuePendingInsert([tabId, frameId, type, message, date.getTime(), location]);
25
}
26
}
27
28
export interface IPageLogRecord {
29
tabId: number;
30
frameId: number;
31
type: string;
32
message: string;
33
timestamp: number;
34
location?: string;
35
}
36
37