export const SEARCH_LIST_FLAGS = [ ["--titles", "titles", "titles"], ["--past-titles", "pastTitles", "pastTitles"], ["--person-names", "personNames"], ["--locations", "locations", "locations"], ["--seniorities", "seniorities", "seniorities"], ["--past-seniorities", "pastSeniorities", "pastSeniorities"], ["--profile-keywords", "profileKeywords", "profileKeywords"], ["--company-keywords", "companyKeywords", "companyKeywords"], ["--industries", "industries", "industries"], ["--functions", "jobFunctions", "functions"], ["--sub-functions", "subFunctions", "subFunctions"], ["--company-domains", "companyDomains"], ["--company-names", "companyNames"], ["--past-company-names", "pastCompanyNames"], ["--company-hq", "companyHeadquarters", "companyHeadquarters"], ["--company-types", "companyTypes", "companyTypes"], ["--universities", "universities", "universities"], ["--skills", "skills", "skills"], ["--languages", "languages", "languages"], ["--headcount", "headcountRanges", "headcount"], ] as const; const EXCLUDE_ALIASES: Record = { "--company-domains": ["--not-domains", "--exclude-domains"], }; export function excludeFlagsFor(flag: string): string[] { const name = flag.slice(2); return [ `--not-${name}`, `--exclude-${name}`, ...(EXCLUDE_ALIASES[flag] ?? []), ]; } export const SEARCH_TEXT_FLAGS = [ ["--keywords", "keywords"], ["--company-domain", "companyDomain"], ] as const; export const SEARCH_RANGE_FLAGS = [ ["--years-in-role", "yearsInRole"], ["--years-at-company", "yearsAtCompany"], ["--days-since-job-change", "daysSinceJobChange"], ["--founded-years", "foundedYears"], ] as const; export const SEARCH_REQUEST_FLAGS = [ "--search", "--filters", "--people-file", "--csv", "--map", "--list", "--enrichment", "--limit", "--page-token", "--preview", "--exact", ] as const; const SEARCH_FLAG_NAMES = new Set([ ...SEARCH_REQUEST_FLAGS, ...SEARCH_LIST_FLAGS.map(([flag]) => flag), ...SEARCH_LIST_FLAGS.flatMap(([flag]) => excludeFlagsFor(flag)), ...SEARCH_TEXT_FLAGS.map(([flag]) => flag), ...SEARCH_RANGE_FLAGS.map(([flag]) => flag), ]); export function usesSearchFlags(args: readonly string[]): boolean { return args.some((token) => SEARCH_FLAG_NAMES.has(token)); } export const FILTER_KEY_ALIASES: Record = { title: "titles", jobtitle: "titles", jobtitles: "titles", role: "titles", roles: "titles", location: "locations", country: "locations", countries: "locations", city: "locations", cities: "locations", region: "locations", regions: "locations", geo: "locations", geography: "locations", industry: "industries", sector: "industries", sectors: "industries", vertical: "industries", verticals: "industries", seniority: "seniorities", level: "seniorities", levels: "seniorities", headcount: "headcountRanges", headcounts: "headcountRanges", headcountrange: "headcountRanges", companysize: "headcountRanges", companysizes: "headcountRanges", employees: "headcountRanges", employeecount: "headcountRanges", size: "headcountRanges", sizes: "headcountRanges", function: "jobFunctions", functions: "jobFunctions", jobfunction: "jobFunctions", department: "jobFunctions", departments: "jobFunctions", subfunction: "subFunctions", domain: "companyDomains", domains: "companyDomains", website: "companyDomains", websites: "companyDomains", company: "companyNames", companies: "companyNames", hq: "companyHeadquarters", headquarters: "companyHeadquarters", companyhq: "companyHeadquarters", companylocation: "companyHeadquarters", companylocations: "companyHeadquarters", companytype: "companyTypes", keyword: "keywords", skill: "skills", university: "universities", school: "universities", schools: "universities", education: "universities", language: "languages", pasttitle: "pastTitles", previoustitles: "pastTitles", pastcompanies: "pastCompanyNames", previouscompanies: "pastCompanyNames", name: "fullName", names: "personNames", founded: "foundedYears", foundedyear: "foundedYears", exact: "exactMatch", };