import { RepeatingFieldsDefinitions, RepeatingFieldsTypes } from '../resources/netlog_defs'; import { NetFields } from './net_fields'; import { TriggerTypes } from './net_trigger'; export type Matches = { [s: string]: string }; export type ToMatches = Record; export type RepeatingFieldsMatchesExtract = { [ key in RepeatingFieldsDefinitions[type]['repeatingFields']['possibleKeys'][ number ] as `${RepeatingFieldsDefinitions[type]['repeatingFields']['label']}${key}` ]?: string; }; export type RepeatingFieldsMatches< type extends TriggerTypes, repeatingType extends RepeatingFieldsTypes = type extends RepeatingFieldsTypes ? type : never, > = repeatingType extends RepeatingFieldsTypes ? RepeatingFieldsMatchesExtract : never; export type NetMatches = { [type in TriggerTypes]: type extends 'None' ? Matches : & Matches & (type extends RepeatingFieldsTypes ? (RepeatingFieldsMatches & ToMatches) : ToMatches); }; export type NetAnyMatches = NetMatches[keyof NetMatches];