getaero-io/gtm-eng-skills / engineering/warm-intro-scoring
warm-intro-scoring
Verifiedplays/collection.ts
View on GitHub/* eslint-disable @typescript-eslint/no-explicit-any -- Ported JSON contract/parity boundary; runtime validators reject malformed values. */
import {exactDate} from './core';
import {canonicalLinkedIn,type Snapshot} from './features';
/** Preserve the retained receipt date; reading cached data never refreshes it. */
export function normalizeCollectedProfile(profile:any,contactId:string,url:string,source:string,requestedDate:string,retainedDate?:string,accountDomain?:string):Snapshot {
const key=canonicalLinkedIn(url);if(!key||canonicalLinkedIn(String(profile.linkedinUrl||profile.linkedin_url||''))!==key)throw Error('Profile identity mismatch');
const dates=[retainedDate,profile.observed_at,profile.scrapedAt].filter(v=>v!==undefined&&v!==null&&v!=='');
if(!dates.length)throw Error('Cached profile requires its original observation date');
const observed=dates.map(v=>{if(typeof v!=='string')throw Error('Invalid original observation date');const day=v.slice(0,10);exactDate(day,'profile observation');return day;}).sort()[0];
if(observed>requestedDate)throw Error('Profile observation is after collection cutoff');
for(const field of ['experience','education'])if(profile[field]!==undefined&&(!Array.isArray(profile[field])||profile[field].some((v:any)=>!v||typeof v!=='object'||Array.isArray(v))))throw Error('Invalid profile history shape');
if(accountDomain!==undefined&&!/^[a-z0-9.-]+\.[a-z]{2,}$/i.test(accountDomain))throw Error('Invalid reviewed account domain');
const experience=profile.experience||[],education=profile.education||[];
const current=experience.find((j:any)=>String(j.endDate?.text||'').toLowerCase()==='present');
return {id:contactId,linkedin_url:url,first_name:String(profile.firstName||profile.first_name||''),last_name:String(profile.lastName||profile.last_name||''),source,observed_at:observed,company:current?.companyName||'',title:current?.position||'',experience,education,...(accountDomain?{domain:accountDomain.toLowerCase()}: {})};
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |