d25d482dc2
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
137 lines
3.6 KiB
TypeScript
137 lines
3.6 KiB
TypeScript
import type { ToolConfig } from '@/tools/types'
|
|
import type {
|
|
ZoomInfoEnrichCompaniesParams,
|
|
ZoomInfoEnrichCompaniesResponse,
|
|
} from '@/tools/zoominfo/types'
|
|
import {
|
|
buildProxyBody,
|
|
extractDataArray,
|
|
parseCsvOrJson,
|
|
parseJsonField,
|
|
transformZoomInfoEnvelope,
|
|
ZOOMINFO_PROXY_URL,
|
|
} from '@/tools/zoominfo/utils'
|
|
|
|
/**
|
|
* Default output fields used when the caller does not specify any. ZoomInfo's
|
|
* CompanyEnrich schema requires `outputFields`, so we send a useful firmographic
|
|
* set rather than letting the request fail. All values are valid CompanyEnrich fields.
|
|
*/
|
|
const DEFAULT_COMPANY_OUTPUT_FIELDS = [
|
|
'id',
|
|
'name',
|
|
'website',
|
|
'domainList',
|
|
'ticker',
|
|
'revenue',
|
|
'revenueRange',
|
|
'employeeCount',
|
|
'employeeRange',
|
|
'primaryIndustry',
|
|
'industries',
|
|
'street',
|
|
'city',
|
|
'state',
|
|
'zipCode',
|
|
'country',
|
|
'phone',
|
|
'foundedYear',
|
|
'companyStatus',
|
|
'socialMediaUrls',
|
|
'logo',
|
|
'description',
|
|
]
|
|
|
|
export const zoominfoEnrichCompaniesTool: ToolConfig<
|
|
ZoomInfoEnrichCompaniesParams,
|
|
ZoomInfoEnrichCompaniesResponse
|
|
> = {
|
|
id: 'zoominfo_enrich_companies',
|
|
name: 'ZoomInfo Enrich Companies',
|
|
description:
|
|
'Enrich up to 25 companies in one request with detailed firmographics, industry, financials, and more.',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
clientId: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'ZoomInfo OAuth client ID',
|
|
},
|
|
clientSecret: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'ZoomInfo OAuth client secret',
|
|
},
|
|
matchCompanyInput: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description:
|
|
'JSON array (1-25 items) of company matching criteria, e.g. [{"companyName":"Acme","companyWebsite":"acme.com"}]',
|
|
},
|
|
outputFields: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description:
|
|
'JSON array or comma-separated list of fields to return (e.g. ["id","name","website","revenue","employeeCount"]). Defaults to a standard firmographic set if omitted.',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: ZOOMINFO_PROXY_URL,
|
|
method: 'POST',
|
|
headers: () => ({ 'Content-Type': 'application/json' }),
|
|
body: (params) => {
|
|
const matchCompanyInput = parseJsonField<unknown>(
|
|
params.matchCompanyInput,
|
|
'matchCompanyInput'
|
|
)
|
|
if (!Array.isArray(matchCompanyInput) || matchCompanyInput.length === 0) {
|
|
throw new Error('matchCompanyInput must be a non-empty JSON array')
|
|
}
|
|
if (matchCompanyInput.length > 25) {
|
|
throw new Error('matchCompanyInput supports a maximum of 25 entries per request')
|
|
}
|
|
|
|
const outputFields = parseCsvOrJson(params.outputFields, 'outputFields')
|
|
const attributes: Record<string, unknown> = {
|
|
matchCompanyInput,
|
|
outputFields: outputFields ?? DEFAULT_COMPANY_OUTPUT_FIELDS,
|
|
}
|
|
|
|
return {
|
|
...buildProxyBody(params),
|
|
path: '/data/v1/companies/enrich',
|
|
method: 'POST',
|
|
body: {
|
|
data: {
|
|
type: 'CompanyEnrich',
|
|
attributes,
|
|
},
|
|
},
|
|
}
|
|
},
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const { data } = await transformZoomInfoEnvelope(response)
|
|
const results = extractDataArray(data)
|
|
return {
|
|
success: true,
|
|
output: { results },
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
results: {
|
|
type: 'array',
|
|
description: 'Enrichment results, one per input with match status and attributes',
|
|
items: { type: 'json' },
|
|
},
|
|
},
|
|
}
|