Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions apps/sim/blocks/blocks/peopledatalabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ export const PeopleDataLabsBlock: BlockConfig<PdlPersonEnrichResponse> = {
id: 'first_name',
title: 'First Name',
type: 'short-input',
placeholder: 'Jane',
condition: { field: 'operation', value: ['pdl_person_enrich', 'pdl_person_identify'] },
mode: 'advanced',
},
{
id: 'last_name',
title: 'Last Name',
type: 'short-input',
placeholder: 'Doe',
condition: { field: 'operation', value: ['pdl_person_enrich', 'pdl_person_identify'] },
mode: 'advanced',
},
Expand Down Expand Up @@ -185,6 +187,7 @@ export const PeopleDataLabsBlock: BlockConfig<PdlPersonEnrichResponse> = {
id: 'pdl_id',
title: 'PDL Company ID',
type: 'short-input',
placeholder: 'people-data-labs',
condition: { field: 'operation', value: 'pdl_company_enrich' },
mode: 'advanced',
},
Expand Down Expand Up @@ -268,6 +271,7 @@ export const PeopleDataLabsBlock: BlockConfig<PdlPersonEnrichResponse> = {
id: 'identify_postal_code',
title: 'Postal Code',
type: 'short-input',
placeholder: '94103',
condition: { field: 'operation', value: 'pdl_person_identify' },
mode: 'advanced',
},
Expand Down Expand Up @@ -366,6 +370,25 @@ export const PeopleDataLabsBlock: BlockConfig<PdlPersonEnrichResponse> = {
mode: 'advanced',
},

// Title case (shared by Person Enrich/Identify/Search, Company Enrich, Autocomplete)
{
id: 'titlecase',
title: 'Title Case Names',
type: 'switch',
condition: {
field: 'operation',
value: [
'pdl_person_enrich',
'pdl_person_identify',
'pdl_person_search',
'pdl_company_enrich',
'pdl_company_search',
'pdl_autocomplete',
],
},
mode: 'advanced',
},

// API Key
{
id: 'apiKey',
Expand Down Expand Up @@ -488,6 +511,18 @@ export const PeopleDataLabsBlock: BlockConfig<PdlPersonEnrichResponse> = {
result.min_likelihood = undefined
}

// titlecase is honored by enrich/identify/search/autocomplete; clear it for others
if (
op !== 'pdl_person_enrich' &&
op !== 'pdl_person_identify' &&
op !== 'pdl_person_search' &&
op !== 'pdl_company_enrich' &&
op !== 'pdl_company_search' &&
op !== 'pdl_autocomplete'
) {
result.titlecase = undefined
}

if (op === 'pdl_person_identify') {
if (params.identify_locality !== undefined) result.locality = params.identify_locality
if (params.identify_region !== undefined) result.region = params.identify_region
Expand Down Expand Up @@ -575,6 +610,8 @@ export const PeopleDataLabsBlock: BlockConfig<PdlPersonEnrichResponse> = {
// Bulk
requests: { type: 'string', description: 'JSON array of bulk request objects' },
required: { type: 'string', description: 'Required-fields expression for bulk' },
// Shared
titlecase: { type: 'boolean', description: 'Return name fields in title case' },
},

outputs: {
Expand Down
7 changes: 7 additions & 0 deletions apps/sim/tools/peopledatalabs/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ export const autocompleteTool: ToolConfig<PdlAutocompleteParams, PdlAutocomplete
visibility: 'user-or-llm',
description: 'Number of suggestions to return (1-100, default 10)',
},
titlecase: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Return name fields in title case',
},
},

request: {
Expand All @@ -53,6 +59,7 @@ export const autocompleteTool: ToolConfig<PdlAutocompleteParams, PdlAutocomplete
field: params.field,
text: params.text,
size: params.size,
titlecase: params.titlecase,
})
return `https://api.peopledatalabs.com/v5/autocomplete${qs}`
},
Expand Down
7 changes: 7 additions & 0 deletions apps/sim/tools/peopledatalabs/company_enrich.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ export const companyEnrichTool: ToolConfig<PdlCompanyEnrichParams, PdlCompanyEnr
visibility: 'user-or-llm',
description: 'Required-fields expression',
},
titlecase: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Return name fields in title case',
},
},

request: {
Expand All @@ -99,6 +105,7 @@ export const companyEnrichTool: ToolConfig<PdlCompanyEnrichParams, PdlCompanyEnr
country: params.country,
min_likelihood: params.min_likelihood,
required: params.required,
titlecase: params.titlecase,
})
return `https://api.peopledatalabs.com/v5/company/enrich${qs}`
},
Expand Down
12 changes: 12 additions & 0 deletions apps/sim/tools/peopledatalabs/company_search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ export const companySearchTool: ToolConfig<PdlCompanySearchParams, PdlCompanySea
visibility: 'user-or-llm',
description: 'Pagination token returned from a prior response',
},
titlecase: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Return name fields in title case',
},
},

request: {
Expand All @@ -64,12 +70,18 @@ export const companySearchTool: ToolConfig<PdlCompanySearchParams, PdlCompanySea
}
if (params.size !== undefined) body.size = Number(params.size)
if (params.scroll_token) body.scroll_token = params.scroll_token
if (params.titlecase !== undefined) body.titlecase = params.titlecase
return body
},
},

transformResponse: async (response: Response) => {
const data = (await response.json()) as Record<string, unknown>
const status = (data.status as number) ?? response.status

if (status === 404) {
return { success: true, output: { total: 0, scroll_token: null, results: [] } }
}

if (!response.ok) {
const error = (data.error as { message?: string })?.message
Expand Down
7 changes: 7 additions & 0 deletions apps/sim/tools/peopledatalabs/person_enrich.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ export const personEnrichTool: ToolConfig<PdlPersonEnrichParams, PdlPersonEnrich
visibility: 'user-or-llm',
description: 'Required-fields expression (e.g., "emails AND job_title")',
},
titlecase: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Return name fields in title case',
},
},

request: {
Expand All @@ -106,6 +112,7 @@ export const personEnrichTool: ToolConfig<PdlPersonEnrichParams, PdlPersonEnrich
location: params.location,
min_likelihood: params.min_likelihood,
required: params.required,
titlecase: params.titlecase,
})
return `https://api.peopledatalabs.com/v5/person/enrich${qs}`
},
Expand Down
7 changes: 7 additions & 0 deletions apps/sim/tools/peopledatalabs/person_identify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ export const personIdentifyTool: ToolConfig<PdlPersonIdentifyParams, PdlPersonId
visibility: 'user-or-llm',
description: 'Include `matched_on` for each match',
},
titlecase: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Return name fields in title case',
},
},

request: {
Expand All @@ -170,6 +176,7 @@ export const personIdentifyTool: ToolConfig<PdlPersonIdentifyParams, PdlPersonId
birth_date: params.birth_date,
data_include: params.data_include,
include_if_matched: params.include_if_matched,
titlecase: params.titlecase,
})
return `https://api.peopledatalabs.com/v5/person/identify${qs}`
},
Expand Down
12 changes: 12 additions & 0 deletions apps/sim/tools/peopledatalabs/person_search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ export const personSearchTool: ToolConfig<PdlPersonSearchParams, PdlPersonSearch
description:
'Dataset filter: all, resume, email, phone, mobile_phone, street_address, consumer_social, developer (combinable with commas, exclude with `-` prefix)',
},
titlecase: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Return name fields in title case',
},
},

request: {
Expand All @@ -72,12 +78,18 @@ export const personSearchTool: ToolConfig<PdlPersonSearchParams, PdlPersonSearch
if (params.size !== undefined) body.size = Number(params.size)
if (params.scroll_token) body.scroll_token = params.scroll_token
if (params.dataset) body.dataset = params.dataset
if (params.titlecase !== undefined) body.titlecase = params.titlecase
return body
},
},

transformResponse: async (response: Response) => {
const data = (await response.json()) as Record<string, unknown>
const status = (data.status as number) ?? response.status

if (status === 404) {
return { success: true, output: { total: 0, scroll_token: null, results: [] } }
}

if (!response.ok) {
const error = (data.error as { message?: string })?.message
Expand Down
6 changes: 6 additions & 0 deletions apps/sim/tools/peopledatalabs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export interface PdlPersonEnrichParams {
location?: string
min_likelihood?: number
required?: string
titlecase?: boolean
}

export interface PdlPersonEnrichResponse extends ToolResponse {
Expand All @@ -234,6 +235,7 @@ export interface PdlPersonSearchParams {
size?: number
scroll_token?: string
dataset?: string
titlecase?: boolean
}

export interface PdlPersonSearchResponse extends ToolResponse {
Expand All @@ -257,6 +259,7 @@ export interface PdlCompanyEnrichParams {
country?: string
min_likelihood?: number
required?: string
titlecase?: boolean
}

export interface PdlCompanyEnrichResponse extends ToolResponse {
Expand All @@ -273,6 +276,7 @@ export interface PdlCompanySearchParams {
query?: string
size?: number
scroll_token?: string
titlecase?: boolean
}

export interface PdlCompanySearchResponse extends ToolResponse {
Expand All @@ -288,6 +292,7 @@ export interface PdlAutocompleteParams {
field: string
text?: string
size?: number
titlecase?: boolean
}

export interface PdlAutocompleteSuggestion {
Expand Down Expand Up @@ -364,6 +369,7 @@ export interface PdlPersonIdentifyParams {
birth_date?: string
data_include?: string
include_if_matched?: boolean
titlecase?: boolean
}

export interface PdlPersonIdentifyMatch {
Expand Down
Loading