You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
683 B
21 lines
683 B
import { z } from "zod";
|
|
|
|
export const regexTesterConfigSchema = z.object({
|
|
maxInputLength: z.number().int().positive().max(1048576).default(102400),
|
|
maxMatches: z.number().int().positive().max(1000).default(100),
|
|
});
|
|
|
|
export type RegexTesterToolConfig = z.infer<typeof regexTesterConfigSchema>;
|
|
|
|
export const DEFAULT_REGEX_TESTER_CONFIG: RegexTesterToolConfig = {
|
|
maxInputLength: 102400,
|
|
maxMatches: 100,
|
|
};
|
|
|
|
export function parseRegexTesterConfig(raw: unknown): RegexTesterToolConfig {
|
|
const parsed = regexTesterConfigSchema.safeParse(raw);
|
|
if (!parsed.success) {
|
|
throw new Error(`Invalid regex-tester config: ${parsed.error.message}`);
|
|
}
|
|
return parsed.data;
|
|
}
|
|
|