Rebasely Beta: data may be purged

justintypescript-ultra-strict Public

TypeScript · 35 lines · 1.9 KiB · at 83c2f03

import { sql, type D1Like, type SafeDb, type Secret, type Untrusted } from "@tsus/v2";import type { ReadRepo, RepoId } from "./repo.access.ts";declare const raw: D1Like;declare const db: SafeDb;declare const apiKey: Secret;declare const report: Untrusted;declare const title: Untrusted;declare const config: { readonly url: string; readonly key: Secret };// Sqlexport const byTitle = (t: string) => db.all(`SELECT * FROM issues WHERE title = '${t}'`); // expect TSUS601export const sorted = (column: string) => raw.prepare("SELECT * FROM issues ORDER BY " + column).all(); // expect TSUS601export const fixedQuery = () => raw.prepare("SELECT count(*) AS n FROM issues").first();export const bound = (t: string) => db.all(sql`SELECT * FROM issues WHERE title = ${t}`);// Permitdeclare const listIssues: (p: ReadRepo) => Promise<readonly string[]>;export const unchecked = (repo: RepoId) => listIssues(repo); // expect TSUS600export const forged = (repo: RepoId) => listIssues({ action: "repo.read", resource: repo }); // expect TSUS600declare const issueCount: (db: SafeDb, p: ReadRepo) => Promise<number>;export const skipped = () => issueCount(db); // expect TSUS600export const twoIds = (p: ReadRepo, repo: RepoId): string => `${p.resource}/${repo}`; // expect TSUS603// Secretexport const banner = (): string => `key: ${apiKey}`; // expect TSUS604export const dump = (): void => console.log("config", config); // expect TSUS604export const asJson = (): string => JSON.stringify(config); // expect TSUS604export const header = (): string => "Bearer " + apiKey; // expect TSUS604// Untrustedexport const row = (): string => `<li>${title}</li>`; // expect TSUS605export const prompt = (): string => `Summarize this bug report:\n${report}`; // expect TSUS606export const messages = () => [{ role: "user", content: "Report: " + report }]; // expect TSUS606export const path = (): string => "/reports/" + String(report); // expect TSUS607