chore: import upstream snapshot with attribution
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:20:55 +08:00
commit d25d482dc2
13754 changed files with 4996608 additions and 0 deletions
@@ -0,0 +1 @@
export { phoneNumberEnrichment } from './phone-number'
@@ -0,0 +1,104 @@
/**
* @vitest-environment node
*/
import { describe, expect, it } from 'vitest'
import { phoneNumberEnrichment } from '@/enrichments/phone-number/phone-number'
import type { EnrichmentProvider } from '@/enrichments/types'
function provider(id: string): EnrichmentProvider {
const p = phoneNumberEnrichment.providers.find((x) => x.id === id)
if (!p) throw new Error(`Provider ${id} not found in phone-number cascade`)
return p
}
const nameDomain = { fullName: 'John Doe', companyDomain: 'https://www.acme.com/careers' }
const linkedinOnly = { fullName: 'John Doe', linkedinUrl: 'https://linkedin.com/in/johndoe' }
describe('phone-number enrichment cascade', () => {
it('chains PDL then the phone-capable hosted providers', () => {
expect(phoneNumberEnrichment.providers.map((p) => p.id)).toEqual([
'pdl',
'wiza',
'findymail',
'prospeo',
'leadmagic',
'datagma',
])
})
describe('wiza (opportunistic)', () => {
const p = provider('wiza')
it('reveals phone, using name+domain or LinkedIn profile_url', () => {
expect(p.toolId).toBe('wiza_individual_reveal')
expect(p.buildParams(nameDomain)).toEqual({
full_name: 'John Doe',
domain: 'acme.com',
enrichment_level: 'phone',
})
expect(p.buildParams(linkedinOnly)).toEqual({
full_name: 'John Doe',
profile_url: 'https://linkedin.com/in/johndoe',
enrichment_level: 'phone',
})
expect(p.buildParams({ fullName: 'John Doe' })).toBeNull()
expect(p.mapOutput({ mobile_phone: '+1555', phones: [] })).toEqual({ phone: '+1555' })
expect(p.mapOutput({ phones: [{ number: '+1777' }] })).toEqual({ phone: '+1777' })
})
})
describe('findymail', () => {
const p = provider('findymail')
it('keys off the LinkedIn URL and skips without one', () => {
expect(p.toolId).toBe('findymail_find_phone')
expect(p.buildParams(linkedinOnly)).toEqual({
linkedin_url: 'https://linkedin.com/in/johndoe',
})
expect(p.buildParams(nameDomain)).toBeNull()
expect(p.mapOutput({ phone: '+1555' })).toEqual({ phone: '+1555' })
expect(p.mapOutput({ phone: null })).toBeNull()
})
})
describe('prospeo (opportunistic)', () => {
const p = provider('prospeo')
it('requests mobile enrichment via name+domain or LinkedIn', () => {
expect(p.toolId).toBe('prospeo_enrich_person')
expect(p.buildParams(nameDomain)).toEqual({
full_name: 'John Doe',
company_website: 'acme.com',
enrich_mobile: true,
})
expect(p.buildParams(linkedinOnly)).toEqual({
full_name: 'John Doe',
linkedin_url: 'https://linkedin.com/in/johndoe',
enrich_mobile: true,
})
expect(p.buildParams({ fullName: 'John Doe' })).toBeNull()
expect(p.mapOutput({ person: { mobile: { mobile: '+1555' } } })).toEqual({ phone: '+1555' })
})
})
describe('leadmagic', () => {
const p = provider('leadmagic')
it('keys off the LinkedIn URL and skips without one', () => {
expect(p.toolId).toBe('leadmagic_find_mobile')
expect(p.buildParams(linkedinOnly)).toEqual({
profile_url: 'https://linkedin.com/in/johndoe',
})
expect(p.buildParams(nameDomain)).toBeNull()
expect(p.mapOutput({ mobile_number: '+1555' })).toEqual({ phone: '+1555' })
expect(p.mapOutput({ mobile_number: null })).toBeNull()
})
})
describe('datagma', () => {
const p = provider('datagma')
it('passes the LinkedIn URL as username and skips without one', () => {
expect(p.toolId).toBe('datagma_find_phone')
expect(p.buildParams(linkedinOnly)).toEqual({ username: 'https://linkedin.com/in/johndoe' })
expect(p.buildParams(nameDomain)).toBeNull()
expect(p.mapOutput({ phone: '+1555' })).toEqual({ phone: '+1555' })
expect(p.mapOutput({ phone: null })).toBeNull()
})
})
})
@@ -0,0 +1,144 @@
import { filterUndefined } from '@sim/utils/object'
import { Phone } from 'lucide-react'
import { firstNonEmpty, normalizeDomain, str, toolProvider } from '@/enrichments/providers'
import type { EnrichmentConfig } from '@/enrichments/types'
/**
* Phone Number enrichment. Finds a contact's phone number from a full name plus
* any available identifiers (company domain, LinkedIn URL) via a waterfall:
* People Data Labs (name match) → Wiza reveal → Findymail (LinkedIn) → Prospeo
* mobile → LeadMagic (LinkedIn) → Datagma (LinkedIn). Each provider
* opportunistically uses whatever identifiers the row provides and self-skips
* when it has none usable, so adding more inputs widens coverage without
* reordering. First phone wins; all providers support hosted keys.
*/
export const phoneNumberEnrichment: EnrichmentConfig = {
id: 'phone-number',
name: 'Phone Number',
description: "Find a contact's phone number from their name, company, or LinkedIn URL.",
icon: Phone,
inputs: [
{ id: 'fullName', name: 'Full name', type: 'string', required: true },
{ id: 'companyDomain', name: 'Company domain', type: 'string' },
{ id: 'linkedinUrl', name: 'LinkedIn URL', type: 'string' },
],
outputs: [{ id: 'phone', name: 'phone', type: 'string' }],
providers: [
toolProvider({
id: 'pdl',
label: 'People Data Labs',
toolId: 'pdl_person_enrich',
buildParams: (inputs) => {
const name = str(inputs.fullName)
if (!name) return null
// `required` makes PDL 404 (free) when the profile has no phone,
// instead of charging a credit for a match we'd discard as a no-match.
return filterUndefined({
name,
company: normalizeDomain(inputs.companyDomain) || undefined,
min_likelihood: 6,
required: 'phone_numbers OR mobile_phone',
})
},
mapOutput: (output) => {
const person = output.person as Record<string, unknown> | undefined
const phone = firstNonEmpty(person?.phone_numbers) ?? str(person?.mobile_phone)
return phone ? { phone } : null
},
}),
toolProvider({
id: 'wiza',
label: 'Wiza',
toolId: 'wiza_individual_reveal',
buildParams: (inputs) => {
const linkedin = str(inputs.linkedinUrl)
const fullName = str(inputs.fullName)
const domain = normalizeDomain(inputs.companyDomain)
// Needs a LinkedIn URL or a name+domain pair; skip otherwise.
if (!linkedin && !(fullName && domain)) return null
// 'phone' reveals the mobile number (5 credits). Prefer LinkedIn when present.
return filterUndefined({
profile_url: linkedin || undefined,
full_name: fullName || undefined,
domain: domain || undefined,
enrichment_level: 'phone',
})
},
mapOutput: (output) => {
const phones = Array.isArray(output.phones)
? (output.phones as Record<string, unknown>[])
: []
const phone = str(output.mobile_phone) || str(output.phone_number) || str(phones[0]?.number)
return phone ? { phone } : null
},
}),
toolProvider({
id: 'findymail',
label: 'Findymail',
toolId: 'findymail_find_phone',
buildParams: (inputs) => {
// Findymail's phone finder keys off a LinkedIn URL only.
const linkedin = str(inputs.linkedinUrl)
if (!linkedin) return null
return { linkedin_url: linkedin }
},
mapOutput: (output) => {
const phone = str(output.phone)
return phone ? { phone } : null
},
}),
toolProvider({
id: 'prospeo',
label: 'Prospeo',
toolId: 'prospeo_enrich_person',
buildParams: (inputs) => {
const linkedin = str(inputs.linkedinUrl)
const fullName = str(inputs.fullName)
const companyWebsite = normalizeDomain(inputs.companyDomain)
if (!linkedin && !(fullName && companyWebsite)) return null
return filterUndefined({
linkedin_url: linkedin || undefined,
full_name: fullName || undefined,
company_website: companyWebsite || undefined,
enrich_mobile: true,
})
},
mapOutput: (output) => {
const person = output.person as Record<string, unknown> | undefined
const mobile = person?.mobile as Record<string, unknown> | undefined
const phone = str(mobile?.mobile)
return phone ? { phone } : null
},
}),
toolProvider({
id: 'leadmagic',
label: 'LeadMagic',
toolId: 'leadmagic_find_mobile',
buildParams: (inputs) => {
// LeadMagic's mobile finder keys off a LinkedIn URL.
const profileUrl = str(inputs.linkedinUrl)
if (!profileUrl) return null
return { profile_url: profileUrl }
},
mapOutput: (output) => {
const phone = str(output.mobile_number)
return phone ? { phone } : null
},
}),
toolProvider({
id: 'datagma',
label: 'Datagma',
toolId: 'datagma_find_phone',
buildParams: (inputs) => {
// Datagma's phone finder takes the full LinkedIn URL as `username`.
const username = str(inputs.linkedinUrl)
if (!username) return null
return { username }
},
mapOutput: (output) => {
const phone = str(output.phone)
return phone ? { phone } : null
},
}),
],
}