Skip to content
Open
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
11 changes: 11 additions & 0 deletions apps/docs/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10504,3 +10504,14 @@ export function PlaneIcon(props: SVGProps<SVGSVGElement>) {
</svg>
)
}

export function DealportIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg {...props} viewBox='0 0 180 180' fill='none' xmlns='http://www.w3.org/2000/svg'>
<g transform='translate(58 30) scale(0.72)' fill='currentColor'>
<path d='M0.095 0L63.9 40.41C73.443 46.46 84.904 53.272 94.031 59.715C94.394 75.06 94.337 93.389 94.17 108.786L57.624 132.028C53.544 134.802 46.862 138.824 42.509 141.152C42.456 131.745 42.253 121.792 42.485 112.43C44.126 110.926 49.237 108.03 51.337 106.694C57.447 102.807 63.765 99.109 69.747 95.018C69.763 87.867 69.729 80.717 69.646 73.567C62.657 68.839 54.772 64.041 47.628 59.534C31.678 49.549 15.805 39.44 0.011 29.209C0.156 19.501 -0.141 9.681 0.095 0Z' />
<path d='M0.189 49.756C2.243 50.742 6.391 53.578 8.491 54.908L24.848 65.293C25.371 73.327 24.972 86.324 24.975 94.732L25.004 151.875C22.163 153.827 18.852 155.788 15.899 157.62C12.139 159.983 3.882 165.357 0.249 166.978C0.616 154.267 0.239 140.131 0.222 127.27L0.189 49.756Z' />
</g>
</svg>
)
}
2 changes: 2 additions & 0 deletions apps/docs/components/ui/icon-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import {
DatadogIcon,
DatagmaIcon,
DaytonaIcon,
DealportIcon,
DevinIcon,
DiscordIcon,
DocumentIcon,
Expand Down Expand Up @@ -427,6 +428,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
datagma: DatagmaIcon,
daytona: DaytonaIcon,
daytona_v2: DaytonaIcon,
dealport: DealportIcon,
deployments: Rocket,
devin: DevinIcon,
devin_v2: DevinIcon,
Expand Down
410 changes: 410 additions & 0 deletions apps/docs/content/docs/integrations/dealport.mdx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions apps/docs/content/docs/integrations/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"datadog",
"datagma",
"daytona",
"dealport",
"deployments",
"devin",
"discord",
Expand Down
108 changes: 108 additions & 0 deletions apps/sim/blocks/blocks/dealport.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/**
* Workflow runs merge raw subBlock inputs under mapped params, so the Dealport mapper must
* clear fields left behind by other operations. Agent tool calls pass the operation in
* `context` and supply arguments under tool parameter names, which the mapper must preserve.
*/
import { describe, expect, it } from 'vitest'
import { DealportBlock } from '@/blocks/blocks/dealport'
import { dealportFindOwnerTool } from '@/tools/dealport/find_owner'
import { dealportPreviewCompaniesTool } from '@/tools/dealport/preview_companies'
import { dealportSearchBuildingsTool } from '@/tools/dealport/search_buildings'
import type { ToolConfig } from '@/tools/types'

const CREDENTIAL = { oauthCredential: 'cred-dealport-1', accessToken: 'dp_live_test_token' }

function requestBody(tool: ToolConfig, params: Record<string, unknown>) {
const body = tool.request.body
if (typeof body !== 'function') throw new Error(`${tool.id} has no request body`)
return body(params)
}

function requestUrl(tool: ToolConfig, params: Record<string, unknown>) {
const url = tool.request.url
return typeof url === 'function' ? url(params) : url
}

function workflowParams(inputs: Record<string, unknown>): Record<string, unknown> {
const mapped = DealportBlock.tools.config?.params?.(inputs) ?? {}
return { ...inputs, ...mapped, accessToken: CREDENTIAL.accessToken }
}

function agentParams(operation: string, args: Record<string, unknown>): Record<string, unknown> {
const inputs = { ...CREDENTIAL, ...args }
const mapped = DealportBlock.tools.config?.params?.(inputs, { operation }) ?? {}
return { ...inputs, ...mapped, accessToken: CREDENTIAL.accessToken }
}

describe('Dealport block parameter mapping', () => {
it('clears company search state and query fields when switching to other operations', () => {
const ownerParams = workflowParams({
...CREDENTIAL,
operation: 'dealport_find_owner',
state: 'OH',
llc_name: 'Tanforan Holdings LLC',
ownerState: '',
})
expect(requestBody(dealportFindOwnerTool, ownerParams)).toEqual({
llc_name: 'Tanforan Holdings LLC',
})

const buildingParams = workflowParams({
...CREDENTIAL,
operation: 'dealport_search_buildings',
q: 'Buckeye Mechanical',
borough: 'BK',
buildingQuery: 'Atlantic Ave',
})
expect(requestUrl(dealportSearchBuildingsTool, buildingParams)).toBe(
'https://app.dealport.com/api/v1/buildings?borough=BK&q=Atlantic+Ave'
)
})

it('coerces numeric and boolean inputs at execution time and rejects non-numeric strings', () => {
const previewParams = workflowParams({
...CREDENTIAL,
operation: 'dealport_preview_companies',
state: 'oh',
naics: '238220, 332710',
min_employees: '15',
independent: 'true',
})
expect(requestBody(dealportPreviewCompaniesTool, previewParams)).toEqual({
state: 'OH',
naics: ['238220', '332710'],
min_employees: 15,
independent: true,
})

expect(() =>
workflowParams({
...CREDENTIAL,
operation: 'dealport_preview_companies',
min_revenue: 'not-a-number',
})
).toThrow('min_revenue must be a number')
})

it('preserves agent tool-call arguments supplied under tool parameter names', () => {
const ownerParams = agentParams('dealport_find_owner', {
llc_name: 'Tanforan Holdings LLC',
state: 'ca',
city: 'San Bruno',
})
expect(requestBody(dealportFindOwnerTool, ownerParams)).toEqual({
llc_name: 'Tanforan Holdings LLC',
state: 'CA',
city: 'San Bruno',
})

const buildingParams = agentParams('dealport_search_buildings', {
borough: 'mn',
q: 'Broadway',
min_units: 20,
})
expect(requestUrl(dealportSearchBuildingsTool, buildingParams)).toBe(
'https://app.dealport.com/api/v1/buildings?borough=MN&min_units=20&q=Broadway'
)
})
})
Loading