mirror of
https://github.com/LukeHagar/arbiter.git
synced 2025-12-06 04:19:14 +00:00
Refactor type annotations in SQLiteStorage class for improved clarity and type safety in sqlite.ts
This commit is contained in:
@@ -80,14 +80,9 @@ export class SQLiteStorage implements StorageAdapter {
|
|||||||
};
|
};
|
||||||
if (!this.db) return empty;
|
if (!this.db) return empty;
|
||||||
try {
|
try {
|
||||||
const rows: Array<{
|
const rows = this.db
|
||||||
startedDateTime: string;
|
|
||||||
time: number;
|
|
||||||
request: string;
|
|
||||||
response: string;
|
|
||||||
}> = this.db
|
|
||||||
.prepare('SELECT startedDateTime, time, request, response FROM har_entries ORDER BY id ASC')
|
.prepare('SELECT startedDateTime, time, request, response FROM har_entries ORDER BY id ASC')
|
||||||
.all();
|
.all() as Array<{ startedDateTime: string; time: number; request: string; response: string }>;
|
||||||
const entries = rows.map(
|
const entries = rows.map(
|
||||||
(r: { startedDateTime: string; time: number; request: string; response: string }) => {
|
(r: { startedDateTime: string; time: number; request: string; response: string }) => {
|
||||||
let req: any = {};
|
let req: any = {};
|
||||||
@@ -133,9 +128,9 @@ export class SQLiteStorage implements StorageAdapter {
|
|||||||
async getAllEndpoints(): Promise<Array<{ path: string; method: string; data: any }>> {
|
async getAllEndpoints(): Promise<Array<{ path: string; method: string; data: any }>> {
|
||||||
if (!this.db) return [];
|
if (!this.db) return [];
|
||||||
try {
|
try {
|
||||||
const rows: Array<{ path: string; method: string; data: string }> = this.db
|
const rows = this.db
|
||||||
.prepare('SELECT path, method, data FROM endpoints')
|
.prepare('SELECT path, method, data FROM endpoints')
|
||||||
.all();
|
.all() as Array<{ path: string; method: string; data: string }>;
|
||||||
return rows.map((r: { path: string; method: string; data: string }) => {
|
return rows.map((r: { path: string; method: string; data: string }) => {
|
||||||
let data: any = {};
|
let data: any = {};
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user