| 494 | } |
| 495 | |
| 496 | function resolveRequestedProperties( |
| 497 | config: HubSpotWebhookConfig, |
| 498 | objectType: string, |
| 499 | filterProperty: string, |
| 500 | userFilters: FilterClause[] |
| 501 | ): string[] { |
| 502 | const requested = new Set<string>() |
| 503 | |
| 504 | const userProperties = Array.isArray(config.properties) |
| 505 | ? config.properties |
| 506 | : typeof config.properties === 'string' |
| 507 | ? config.properties.split(/[\n,]/) |
| 508 | : [] |
| 509 | |
| 510 | for (const name of userProperties) { |
| 511 | const trimmed = name.trim() |
| 512 | if (trimmed) requested.add(trimmed) |
| 513 | } |
| 514 | |
| 515 | if (requested.size === 0 && objectType in BUILT_IN_PATH) { |
| 516 | for (const name of DEFAULT_PROPERTIES[objectType as HubSpotBuiltInObjectType]) { |
| 517 | requested.add(name) |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | requested.add('createdate') |
| 522 | requested.add(filterProperty) |
| 523 | if (config.targetPropertyName?.trim()) { |
| 524 | requested.add(config.targetPropertyName.trim()) |
| 525 | } |
| 526 | for (const f of userFilters) { |
| 527 | if (f.propertyName) requested.add(f.propertyName) |
| 528 | } |
| 529 | |
| 530 | return [...requested] |
| 531 | } |
| 532 | |
| 533 | function buildUserFilters( |
| 534 | config: HubSpotWebhookConfig, |