chore: auto-fix lint & formatting [skip ci]

This commit is contained in:
github-actions[bot] 2026-08-17 07:51:36 +00:00
parent 9eeafb8c15
commit 7c37f5d8b6
19 changed files with 101 additions and 116 deletions

View file

@ -85,4 +85,4 @@ export async function loadConfig(env: Env): Promise<Config> {
configCache = { config, expiresAt: Date.now() + CONFIG_CACHE_TTL };
return config;
}
}

View file

@ -66,4 +66,4 @@ export function deliveryKey(
deliveryId: string,
): string {
return `delivery:${provider}:${groupId ?? "global"}:${deliveryId}`;
}
}

View file

@ -56,4 +56,4 @@ export function d1MessageTracker(db: D1Database): MessageTracker {
export function messageTracker(db: D1Database, kv: KVNamespace): MessageTracker {
return canUseD1(db) ? d1MessageTracker(db) : kvMessageTracker(kv);
}
}

View file

@ -1,10 +1,7 @@
import type { SendRecord } from "./send-log";
import { log } from "./log";
export async function recordSendBatch(
db: D1Database,
records: SendRecord[],
): Promise<void> {
export async function recordSendBatch(db: D1Database, records: SendRecord[]): Promise<void> {
if (records.length === 0) return;
try {
const stmts = records.map((r) =>
@ -38,4 +35,4 @@ export async function recordSendBatch(
} catch (err) {
log.warn({ err, count: records.length }, "Failed to record send log batch");
}
}
}

View file

@ -3,7 +3,7 @@ import { r2PayloadStore } from "../storage/payload";
import { canUseD1 } from "../storage/d1";
export type DeliveryStatus =
| "pending" | "processing" | "delivered" | "retrying" | "failed" | "dead";
"pending" | "processing" | "delivered" | "retrying" | "failed" | "dead";
export interface DeliveryMessage {
deliveryId: string;

View file

@ -239,4 +239,4 @@ export function d1ConfigStore(db: D1Database, kv: KVNamespace): ConfigStore {
groupsCache = null;
},
};
}
}

View file

@ -7,8 +7,5 @@
* while production eagerly routes through D1.
*/
export function canUseD1(db: D1Database | undefined | null): boolean {
return (
typeof db?.prepare === "function" &&
typeof (db as D1Database).batch === "function"
);
}
return typeof db?.prepare === "function" && typeof (db as D1Database).batch === "function";
}

View file

@ -41,9 +41,7 @@ export function r2PayloadStore(env: Env): PayloadStore {
return {
async put(payload: string, ttl?: number): Promise<string> {
const key = generateKey();
const expires = new Date(
Date.now() + (ttl ?? DEFAULT_TTL_SECONDS) * 1000,
);
const expires = new Date(Date.now() + (ttl ?? DEFAULT_TTL_SECONDS) * 1000);
await bucket.put(key, payload, {
httpMetadata: { contentType: "application/json" },
customMetadata: { expires: expires.toISOString() },
@ -61,4 +59,4 @@ export function r2PayloadStore(env: Env): PayloadStore {
await bucket.delete(key);
},
};
}
}

View file

@ -24,9 +24,7 @@ export default defineTask({
.bind(now - DELIVERY_STATE_RETENTION_MS)
.run();
removed += delivery.meta?.changes ?? 0;
const messages = await env.DB.prepare(
"DELETE FROM message_tracking WHERE updated_at < ?",
)
const messages = await env.DB.prepare("DELETE FROM message_tracking WHERE updated_at < ?")
.bind(now - MESSAGE_TRACKING_RETENTION_MS)
.run();
removed += messages.meta?.changes ?? 0;
@ -37,4 +35,4 @@ export default defineTask({
return { result: "error" };
}
},
});
});