import { z } from 'zod'; import { createBuiltInParserDefinition } from '../../internals/createBuiltInParserDefinition.js'; import { applyTo } from '../../shared/definition.js'; export const prefixByParserName = 'prefix-by'; export const prefixByParserOptionsSchema = z .object({ all: z.string().optional(), group: z.string().optional(), collection: z.string().optional(), token: z.string().optional(), applyTo, }) .strict(); // .superRefine((val, ctx) => { // if (!val.all && !val.group && !val.collection && !val.token) { // ctx.addIssue({ // code: z.ZodIssueCode.custom, // message: 'You need to define at least one of: "all", "token", "group" or "collection".', // }); // } // // if (val.all && (val.group || val.collection || val.token)) { // ctx.addIssue({ // code: z.ZodIssueCode.custom, // message: // 'You can\'t provide "all" and one of "group", "collection" or "token" at the same time. Please only provide "all" or one of "token", "group" or "collection"', // }); // } // }); export const prefixByParserDefinition = createBuiltInParserDefinition({ name: prefixByParserName, kind: 'utility', hasOptionalOptions: false, optionsSchema: prefixByParserOptionsSchema, hasOptionalOutput: true, outputTypes: undefined, inTypes: ['SDTF', 'SDTF Engine'], outType: 'SDTF Engine', }); export type PrefixByParserDefinition = typeof prefixByParserDefinition; export type PrefixByParserOptions = z.infer;