release: WRNexusJS 0.4.0

This commit is contained in:
2026-07-27 12:42:18 +05:30
parent 8b728a3e5d
commit 30e5721e84
250 changed files with 10065 additions and 3923 deletions
+3 -6
View File
@@ -1,10 +1,6 @@
import type { Context } from "@wrnexus/core";
import type { ObjectSchema, ParseResult } from "@wrnexus/validation";
import type {
CaptchaEngine,
CaptchaProvider,
CaptchaVerificationResult,
} from "./types.ts";
import type { CaptchaEngine, CaptchaProvider, CaptchaVerificationResult } from "./types.ts";
import { selfHostedProvider } from "./providers/self-hosted.ts";
export interface ParseWithCaptchaOptions {
@@ -28,7 +24,8 @@ export async function parseWithCaptcha<T = Record<string, unknown>>(
options: ParseWithCaptchaOptions,
): Promise<CaptchaParseResult<T>> {
const parsed = schema.parse(input) as ParseResult<T>;
const provider = options.provider ?? (options.engine ? selfHostedProvider(options.engine) : undefined);
const provider =
options.provider ?? (options.engine ? selfHostedProvider(options.engine) : undefined);
if (!provider) throw new TypeError("parseWithCaptcha requires provider or engine");
const field = options.responseField ?? provider.client.responseField;
const token = input[field] ?? input.captchaToken ?? input.responseToken;