feat: initial commit

This commit is contained in:
2026-06-29 23:07:14 +00:00
commit 3b9a6bc85c
152 changed files with 12558 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import getApiDynamic from "./api/getdb.dyn.js";
import getSqliteDynamic from "./sqlite/getdb.dyn.js";
import type { GetDbDynamic, GetDbStatic } from "./types/GetDb.js";
const dynamicSources: GetDbDynamic[] = [getSqliteDynamic, getApiDynamic];
export async function getDbSources(url: string): Promise<GetDbStatic[]> {
const urlObj = new URL(url);
const dbSources: GetDbStatic[] = [];
const promises: Promise<void>[] = [];
for (const source of dynamicSources) {
if (source.protocols.includes(urlObj.protocol)) {
promises.push(
source
.getSource(url)
.catch(() => null)
.then((dbSource) => {
if (dbSource) dbSources.push(dbSource);
})
);
}
}
await Promise.all(promises);
return dbSources;
}