Template
1
0

feat: biome check

This commit is contained in:
2025-09-25 14:29:15 +02:00
parent f2ba21a7e3
commit 0819534901
68 changed files with 211 additions and 802 deletions

View File

@@ -1,4 +1,4 @@
import { Collection, type CollectionOptions, type Db, type Document, type MongoClient } from "mongodb";
import type { Collection, CollectionOptions, Db, Document, MongoClient } from "mongodb";
import { mongo } from "./client.ts";

View File

@@ -9,4 +9,4 @@
"mongodb": "6.20.0",
"zod": "4.1.11"
}
}
}

View File

@@ -1,5 +1,5 @@
import type { Db } from "mongodb";
import z, { type ZodObject, type ZodType } from "zod";
import type { ZodObject, ZodType, z } from "zod";
/**
* TODO ...
@@ -29,7 +29,7 @@ export function makeDocumentParser<TSchema extends ZodObject>(schema: TSchema):
export function toParsedDocuments<TSchema extends ZodType>(
schema: TSchema,
): (documents: unknown[]) => Promise<z.infer<TSchema>[]> {
return async function (documents: unknown[]) {
return async (documents: unknown[]) => {
const parsed = [];
for (const document of documents) {
parsed.push(await schema.parseAsync(document));
@@ -44,7 +44,7 @@ export function toParsedDocuments<TSchema extends ZodType>(
export function toParsedDocument<TSchema extends ZodType>(
schema: TSchema,
): (document?: unknown) => Promise<z.infer<TSchema> | undefined> {
return async function (document: unknown) {
return async (document: unknown) => {
if (document === undefined || document === null) {
return undefined;
}