@twentyhq/people-data-labs 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/manifest.json +11504 -0
  2. package/package.json +1 -1
  3. package/src/front-components/enrich-companies-component-effect.mjs +73 -0
  4. package/src/front-components/enrich-companies-component-effect.mjs.map +7 -0
  5. package/src/front-components/enrich-people-component-effect.mjs +73 -0
  6. package/src/front-components/enrich-people-component-effect.mjs.map +7 -0
  7. package/src/logic-functions/enrich-companies.function.mjs +6134 -0
  8. package/src/logic-functions/enrich-companies.function.mjs.map +7 -0
  9. package/src/logic-functions/enrich-company.function.mjs +6219 -0
  10. package/src/logic-functions/enrich-company.function.mjs.map +7 -0
  11. package/src/logic-functions/enrich-people.function.mjs +6836 -0
  12. package/src/logic-functions/enrich-people.function.mjs.map +7 -0
  13. package/src/logic-functions/enrich-person.function.mjs +6922 -0
  14. package/src/logic-functions/enrich-person.function.mjs.map +7 -0
  15. package/src/logic-functions/post-install.function.mjs +48 -0
  16. package/src/logic-functions/post-install.function.mjs.map +7 -0
  17. package/.claude/settings.local.json +0 -7
  18. package/.nvmrc +0 -1
  19. package/.oxlintrc.json +0 -58
  20. package/.yarnrc.yml +0 -1
  21. package/README.md +0 -16
  22. package/src/__tests__/global-setup.ts +0 -87
  23. package/src/__tests__/people-data-labs.integration-test.ts +0 -25
  24. package/src/application-config.ts +0 -18
  25. package/src/command-menu-items/enrich-companies.ts +0 -14
  26. package/src/command-menu-items/enrich-people.ts +0 -14
  27. package/src/constants/__tests__/select-option-constants.spec.ts +0 -142
  28. package/src/constants/billing-margin-multiplier.ts +0 -1
  29. package/src/constants/company-match-cost-dollars.ts +0 -1
  30. package/src/constants/company-type-options.ts +0 -46
  31. package/src/constants/enrichment-status-options.ts +0 -19
  32. package/src/constants/enrichment-workflow-seeds.ts +0 -27
  33. package/src/constants/funding-stage-options.ts +0 -195
  34. package/src/constants/industry-options.ts +0 -1033
  35. package/src/constants/inferred-salary-options.ts +0 -81
  36. package/src/constants/job-role-options.ts +0 -172
  37. package/src/constants/job-title-class-options.ts +0 -39
  38. package/src/constants/job-title-sub-role-options.ts +0 -746
  39. package/src/constants/location-continent-options.ts +0 -53
  40. package/src/constants/metro-options.ts +0 -2692
  41. package/src/constants/mic-exchange-options.ts +0 -494
  42. package/src/constants/micro-credits-per-dollar.ts +0 -1
  43. package/src/constants/pdl-base-url.ts +0 -1
  44. package/src/constants/person-match-cost-dollars.ts +0 -1
  45. package/src/constants/seniority-options.ts +0 -74
  46. package/src/constants/sex-options.ts +0 -18
  47. package/src/constants/size-options.ts +0 -60
  48. package/src/constants/universal-identifiers.ts +0 -1516
  49. package/src/constants/update-fields-option-values.ts +0 -5
  50. package/src/constants/update-fields-options.ts +0 -7
  51. package/src/fields/company/pdl-affiliated-profiles.field.ts +0 -20
  52. package/src/fields/company/pdl-alternative-domains.field.ts +0 -20
  53. package/src/fields/company/pdl-alternative-names.field.ts +0 -20
  54. package/src/fields/company/pdl-company-type.field.ts +0 -28
  55. package/src/fields/company/pdl-employee-count-by-country.field.ts +0 -21
  56. package/src/fields/company/pdl-employee-count.field.ts +0 -19
  57. package/src/fields/company/pdl-enrichment-status.field.ts +0 -29
  58. package/src/fields/company/pdl-facebook-url.field.ts +0 -19
  59. package/src/fields/company/pdl-founded-year.field.ts +0 -19
  60. package/src/fields/company/pdl-funding-stages.field.ts +0 -28
  61. package/src/fields/company/pdl-headline.field.ts +0 -19
  62. package/src/fields/company/pdl-id.field.ts +0 -19
  63. package/src/fields/company/pdl-industry-detail.field.ts +0 -20
  64. package/src/fields/company/pdl-industry.field.ts +0 -28
  65. package/src/fields/company/pdl-last-enriched-at.field.ts +0 -20
  66. package/src/fields/company/pdl-last-funding-date.field.ts +0 -20
  67. package/src/fields/company/pdl-latest-funding-stage.field.ts +0 -29
  68. package/src/fields/company/pdl-legal-name.field.ts +0 -19
  69. package/src/fields/company/pdl-linkedin-id.field.ts +0 -19
  70. package/src/fields/company/pdl-location-continent.field.ts +0 -29
  71. package/src/fields/company/pdl-location-metro.field.ts +0 -28
  72. package/src/fields/company/pdl-mic-exchange.field.ts +0 -28
  73. package/src/fields/company/pdl-naics.field.ts +0 -19
  74. package/src/fields/company/pdl-number-funding-rounds.field.ts +0 -20
  75. package/src/fields/company/pdl-raw-payload.field.ts +0 -19
  76. package/src/fields/company/pdl-sic.field.ts +0 -19
  77. package/src/fields/company/pdl-size-range.field.ts +0 -28
  78. package/src/fields/company/pdl-summary.field.ts +0 -19
  79. package/src/fields/company/pdl-tags.field.ts +0 -19
  80. package/src/fields/company/pdl-ticker.field.ts +0 -19
  81. package/src/fields/company/pdl-total-funding.field.ts +0 -19
  82. package/src/fields/company/pdl-twitter-url.field.ts +0 -19
  83. package/src/fields/person/pdl-birth-date.field.ts +0 -19
  84. package/src/fields/person/pdl-birth-year.field.ts +0 -19
  85. package/src/fields/person/pdl-certifications.field.ts +0 -19
  86. package/src/fields/person/pdl-education.field.ts +0 -19
  87. package/src/fields/person/pdl-enrichment-status.field.ts +0 -29
  88. package/src/fields/person/pdl-experience.field.ts +0 -19
  89. package/src/fields/person/pdl-facebook-url.field.ts +0 -19
  90. package/src/fields/person/pdl-github-url.field.ts +0 -19
  91. package/src/fields/person/pdl-headline.field.ts +0 -19
  92. package/src/fields/person/pdl-id.field.ts +0 -19
  93. package/src/fields/person/pdl-industry.field.ts +0 -28
  94. package/src/fields/person/pdl-inferred-salary.field.ts +0 -28
  95. package/src/fields/person/pdl-interests.field.ts +0 -19
  96. package/src/fields/person/pdl-job-onet-code.field.ts +0 -19
  97. package/src/fields/person/pdl-job-role.field.ts +0 -28
  98. package/src/fields/person/pdl-job-start-date.field.ts +0 -19
  99. package/src/fields/person/pdl-job-summary.field.ts +0 -19
  100. package/src/fields/person/pdl-job-title-class.field.ts +0 -28
  101. package/src/fields/person/pdl-job-title-sub-role.field.ts +0 -29
  102. package/src/fields/person/pdl-languages.field.ts +0 -19
  103. package/src/fields/person/pdl-last-enriched-at.field.ts +0 -19
  104. package/src/fields/person/pdl-likelihood.field.ts +0 -19
  105. package/src/fields/person/pdl-linkedin-connections.field.ts +0 -20
  106. package/src/fields/person/pdl-linkedin-username.field.ts +0 -20
  107. package/src/fields/person/pdl-location-metro.field.ts +0 -28
  108. package/src/fields/person/pdl-location.field.ts +0 -19
  109. package/src/fields/person/pdl-name-aliases.field.ts +0 -19
  110. package/src/fields/person/pdl-profiles.field.ts +0 -19
  111. package/src/fields/person/pdl-raw-payload.field.ts +0 -19
  112. package/src/fields/person/pdl-seniority.field.ts +0 -28
  113. package/src/fields/person/pdl-sex.field.ts +0 -28
  114. package/src/fields/person/pdl-skills.field.ts +0 -19
  115. package/src/fields/person/pdl-summary.field.ts +0 -19
  116. package/src/fields/person/pdl-twitter-url.field.ts +0 -19
  117. package/src/fields/person/pdl-years-experience.field.ts +0 -21
  118. package/src/front-components/enrich-companies-component-effect.tsx +0 -21
  119. package/src/front-components/enrich-people-component-effect.tsx +0 -21
  120. package/src/front-components/utils/call-enrich-logic-function.utils.ts +0 -21
  121. package/src/logic-functions/__mocks__/company-node.mock.ts +0 -11
  122. package/src/logic-functions/__mocks__/create-core-api-client-mock.ts +0 -35
  123. package/src/logic-functions/__mocks__/pdl-company-data.mock.ts +0 -27
  124. package/src/logic-functions/__mocks__/pdl-person-data.mock.ts +0 -23
  125. package/src/logic-functions/__mocks__/person-node.mock.ts +0 -12
  126. package/src/logic-functions/enrich-companies.function.ts +0 -76
  127. package/src/logic-functions/enrich-company.function.ts +0 -73
  128. package/src/logic-functions/enrich-people.function.ts +0 -76
  129. package/src/logic-functions/enrich-person.function.ts +0 -73
  130. package/src/logic-functions/errors/__tests__/pdl-config-error.spec.ts +0 -16
  131. package/src/logic-functions/errors/__tests__/pdl-invalid-input-error.spec.ts +0 -16
  132. package/src/logic-functions/errors/__tests__/pdl-operation-error.spec.ts +0 -16
  133. package/src/logic-functions/errors/__tests__/pdl-record-not-found-error.spec.ts +0 -21
  134. package/src/logic-functions/errors/pdl-config-error.ts +0 -8
  135. package/src/logic-functions/errors/pdl-error-code.ts +0 -8
  136. package/src/logic-functions/errors/pdl-error.ts +0 -12
  137. package/src/logic-functions/errors/pdl-invalid-input-error.ts +0 -8
  138. package/src/logic-functions/errors/pdl-operation-error.ts +0 -8
  139. package/src/logic-functions/errors/pdl-record-not-found-error.ts +0 -22
  140. package/src/logic-functions/handlers/__tests__/enrich-companies.spec.ts +0 -159
  141. package/src/logic-functions/handlers/__tests__/enrich-company.spec.ts +0 -147
  142. package/src/logic-functions/handlers/__tests__/enrich-people.spec.ts +0 -313
  143. package/src/logic-functions/handlers/__tests__/enrich-person.spec.ts +0 -198
  144. package/src/logic-functions/handlers/__tests__/post-install.spec.ts +0 -153
  145. package/src/logic-functions/handlers/company-enrichment-adapter.ts +0 -42
  146. package/src/logic-functions/handlers/company-single-enrichment-adapter.ts +0 -15
  147. package/src/logic-functions/handlers/enrich-companies.ts +0 -15
  148. package/src/logic-functions/handlers/enrich-company.ts +0 -19
  149. package/src/logic-functions/handlers/enrich-people.ts +0 -15
  150. package/src/logic-functions/handlers/enrich-person.ts +0 -19
  151. package/src/logic-functions/handlers/person-enrichment-adapter.ts +0 -29
  152. package/src/logic-functions/handlers/person-single-enrichment-adapter.ts +0 -15
  153. package/src/logic-functions/handlers/post-install.ts +0 -69
  154. package/src/logic-functions/post-install.function.ts +0 -17
  155. package/src/logic-functions/utils/__tests__/aggregate-bulk-enrich-result.spec.ts +0 -52
  156. package/src/logic-functions/utils/__tests__/build-address.spec.ts +0 -30
  157. package/src/logic-functions/utils/__tests__/build-allowed-values.spec.ts +0 -16
  158. package/src/logic-functions/utils/__tests__/build-bulk-records-trigger.spec.ts +0 -26
  159. package/src/logic-functions/utils/__tests__/build-company-create-data.spec.ts +0 -37
  160. package/src/logic-functions/utils/__tests__/build-company-match-keys.spec.ts +0 -35
  161. package/src/logic-functions/utils/__tests__/build-company-matched-data.spec.ts +0 -56
  162. package/src/logic-functions/utils/__tests__/build-currency-from-usd.spec.ts +0 -17
  163. package/src/logic-functions/utils/__tests__/build-emails.spec.ts +0 -23
  164. package/src/logic-functions/utils/__tests__/build-error-result.spec.ts +0 -16
  165. package/src/logic-functions/utils/__tests__/build-full-name.spec.ts +0 -64
  166. package/src/logic-functions/utils/__tests__/build-links.spec.ts +0 -25
  167. package/src/logic-functions/utils/__tests__/build-logic-function-step.spec.ts +0 -33
  168. package/src/logic-functions/utils/__tests__/build-matched-result.spec.ts +0 -33
  169. package/src/logic-functions/utils/__tests__/build-not-found-result.spec.ts +0 -15
  170. package/src/logic-functions/utils/__tests__/build-person-matched-data.spec.ts +0 -117
  171. package/src/logic-functions/utils/__tests__/build-person-name-param.spec.ts +0 -17
  172. package/src/logic-functions/utils/__tests__/build-phones.spec.ts +0 -32
  173. package/src/logic-functions/utils/__tests__/build-skipped-result.spec.ts +0 -17
  174. package/src/logic-functions/utils/__tests__/capitalize-name.spec.ts +0 -26
  175. package/src/logic-functions/utils/__tests__/capitalize-name.test.ts +0 -17
  176. package/src/logic-functions/utils/__tests__/charge-matched-enrichments.spec.ts +0 -56
  177. package/src/logic-functions/utils/__tests__/chunk.spec.ts +0 -25
  178. package/src/logic-functions/utils/__tests__/enrich-companies.spec.ts +0 -26
  179. package/src/logic-functions/utils/__tests__/enrich-company.spec.ts +0 -54
  180. package/src/logic-functions/utils/__tests__/enrich-people.spec.ts +0 -32
  181. package/src/logic-functions/utils/__tests__/enrich-person.spec.ts +0 -62
  182. package/src/logic-functions/utils/__tests__/extract-company-match-params.spec.ts +0 -86
  183. package/src/logic-functions/utils/__tests__/extract-pdl-error-message.spec.ts +0 -17
  184. package/src/logic-functions/utils/__tests__/extract-person-match-params.spec.ts +0 -75
  185. package/src/logic-functions/utils/__tests__/extract-record-ids.spec.ts +0 -32
  186. package/src/logic-functions/utils/__tests__/find-company-id-by-filter.spec.ts +0 -42
  187. package/src/logic-functions/utils/__tests__/find-company-id.spec.ts +0 -118
  188. package/src/logic-functions/utils/__tests__/find-existing-workflow-id.spec.ts +0 -26
  189. package/src/logic-functions/utils/__tests__/find-or-create-current-company.spec.ts +0 -203
  190. package/src/logic-functions/utils/__tests__/get-pdl-api-key.spec.ts +0 -38
  191. package/src/logic-functions/utils/__tests__/is-empty-address.spec.ts +0 -20
  192. package/src/logic-functions/utils/__tests__/is-empty-emails.spec.ts +0 -14
  193. package/src/logic-functions/utils/__tests__/is-empty-full-name.spec.ts +0 -14
  194. package/src/logic-functions/utils/__tests__/is-empty-links.spec.ts +0 -14
  195. package/src/logic-functions/utils/__tests__/is-empty-phones.spec.ts +0 -14
  196. package/src/logic-functions/utils/__tests__/is-empty-text.spec.ts +0 -15
  197. package/src/logic-functions/utils/__tests__/map-company.spec.ts +0 -48
  198. package/src/logic-functions/utils/__tests__/map-person.spec.ts +0 -81
  199. package/src/logic-functions/utils/__tests__/normalize-domain.spec.ts +0 -19
  200. package/src/logic-functions/utils/__tests__/normalize-linkedin-url.spec.ts +0 -22
  201. package/src/logic-functions/utils/__tests__/now-iso.spec.ts +0 -9
  202. package/src/logic-functions/utils/__tests__/parse-geo.spec.ts +0 -21
  203. package/src/logic-functions/utils/__tests__/parse-partial-date.spec.ts +0 -29
  204. package/src/logic-functions/utils/__tests__/parse-pdl-item.spec.ts +0 -88
  205. package/src/logic-functions/utils/__tests__/pick-multi-select.spec.ts +0 -28
  206. package/src/logic-functions/utils/__tests__/pick-select.spec.ts +0 -38
  207. package/src/logic-functions/utils/__tests__/pick-writable-standard.spec.ts +0 -37
  208. package/src/logic-functions/utils/__tests__/post-pdl-enrich.spec.ts +0 -192
  209. package/src/logic-functions/utils/__tests__/post-pdl-single-enrich.spec.ts +0 -172
  210. package/src/logic-functions/utils/__tests__/read-companies.spec.ts +0 -39
  211. package/src/logic-functions/utils/__tests__/read-people.spec.ts +0 -40
  212. package/src/logic-functions/utils/__tests__/resolve-logic-function-id.spec.ts +0 -25
  213. package/src/logic-functions/utils/__tests__/resolve-update-fields-mode.spec.ts +0 -34
  214. package/src/logic-functions/utils/__tests__/run-batch-enrichment.spec.ts +0 -524
  215. package/src/logic-functions/utils/__tests__/salary-transform.spec.ts +0 -15
  216. package/src/logic-functions/utils/__tests__/seed-enrichment-workflow.spec.ts +0 -136
  217. package/src/logic-functions/utils/__tests__/size-transform.spec.ts +0 -18
  218. package/src/logic-functions/utils/__tests__/to-json-array.spec.ts +0 -16
  219. package/src/logic-functions/utils/__tests__/to-json-object.spec.ts +0 -18
  220. package/src/logic-functions/utils/__tests__/to-number.spec.ts +0 -17
  221. package/src/logic-functions/utils/__tests__/to-string-array.spec.ts +0 -17
  222. package/src/logic-functions/utils/__tests__/to-text.spec.ts +0 -20
  223. package/src/logic-functions/utils/__tests__/update-companies-status.spec.ts +0 -32
  224. package/src/logic-functions/utils/__tests__/update-company-record.spec.ts +0 -25
  225. package/src/logic-functions/utils/__tests__/update-people-status.spec.ts +0 -32
  226. package/src/logic-functions/utils/__tests__/update-person-record.spec.ts +0 -25
  227. package/src/logic-functions/utils/aggregate-bulk-enrich-result.ts +0 -21
  228. package/src/logic-functions/utils/build-address.ts +0 -40
  229. package/src/logic-functions/utils/build-allowed-values.ts +0 -5
  230. package/src/logic-functions/utils/build-bulk-records-trigger.ts +0 -25
  231. package/src/logic-functions/utils/build-company-create-data.ts +0 -35
  232. package/src/logic-functions/utils/build-company-match-keys.ts +0 -16
  233. package/src/logic-functions/utils/build-company-matched-data.ts +0 -56
  234. package/src/logic-functions/utils/build-currency-from-usd.ts +0 -16
  235. package/src/logic-functions/utils/build-emails.ts +0 -34
  236. package/src/logic-functions/utils/build-error-result.ts +0 -18
  237. package/src/logic-functions/utils/build-full-name.ts +0 -38
  238. package/src/logic-functions/utils/build-links.ts +0 -23
  239. package/src/logic-functions/utils/build-logic-function-step.ts +0 -30
  240. package/src/logic-functions/utils/build-matched-result.ts +0 -21
  241. package/src/logic-functions/utils/build-not-found-result.ts +0 -9
  242. package/src/logic-functions/utils/build-person-matched-data.ts +0 -78
  243. package/src/logic-functions/utils/build-person-name-param.ts +0 -19
  244. package/src/logic-functions/utils/build-phones.ts +0 -40
  245. package/src/logic-functions/utils/build-skipped-result.ts +0 -15
  246. package/src/logic-functions/utils/capitalize-name.ts +0 -8
  247. package/src/logic-functions/utils/charge-matched-enrichments.ts +0 -29
  248. package/src/logic-functions/utils/chunk.ts +0 -18
  249. package/src/logic-functions/utils/enrich-chunk.ts +0 -361
  250. package/src/logic-functions/utils/enrich-companies.ts +0 -21
  251. package/src/logic-functions/utils/enrich-company.ts +0 -23
  252. package/src/logic-functions/utils/enrich-people.ts +0 -22
  253. package/src/logic-functions/utils/enrich-person.ts +0 -24
  254. package/src/logic-functions/utils/extract-company-match-params.ts +0 -52
  255. package/src/logic-functions/utils/extract-pdl-error-message.ts +0 -47
  256. package/src/logic-functions/utils/extract-person-match-params.ts +0 -59
  257. package/src/logic-functions/utils/extract-record-ids.ts +0 -18
  258. package/src/logic-functions/utils/find-company-id-by-filter.ts +0 -28
  259. package/src/logic-functions/utils/find-company-id.ts +0 -59
  260. package/src/logic-functions/utils/find-existing-workflow-id.ts +0 -18
  261. package/src/logic-functions/utils/find-or-create-current-company.ts +0 -108
  262. package/src/logic-functions/utils/get-pdl-api-key.ts +0 -15
  263. package/src/logic-functions/utils/internal-field-names.ts +0 -6
  264. package/src/logic-functions/utils/is-empty-address.ts +0 -20
  265. package/src/logic-functions/utils/is-empty-emails.ts +0 -13
  266. package/src/logic-functions/utils/is-empty-full-name.ts +0 -13
  267. package/src/logic-functions/utils/is-empty-links.ts +0 -13
  268. package/src/logic-functions/utils/is-empty-phones.ts +0 -13
  269. package/src/logic-functions/utils/is-empty-text.ts +0 -4
  270. package/src/logic-functions/utils/map-company.ts +0 -115
  271. package/src/logic-functions/utils/map-person.ts +0 -136
  272. package/src/logic-functions/utils/normalize-domain.ts +0 -22
  273. package/src/logic-functions/utils/normalize-linkedin-url.ts +0 -23
  274. package/src/logic-functions/utils/now-iso.ts +0 -1
  275. package/src/logic-functions/utils/parse-geo.ts +0 -33
  276. package/src/logic-functions/utils/parse-partial-date.ts +0 -33
  277. package/src/logic-functions/utils/parse-pdl-item.ts +0 -82
  278. package/src/logic-functions/utils/pick-multi-select.ts +0 -32
  279. package/src/logic-functions/utils/pick-select.ts +0 -30
  280. package/src/logic-functions/utils/pick-writable-standard.ts +0 -27
  281. package/src/logic-functions/utils/post-pdl-enrich.ts +0 -89
  282. package/src/logic-functions/utils/post-pdl-single-enrich.ts +0 -59
  283. package/src/logic-functions/utils/read-companies.ts +0 -53
  284. package/src/logic-functions/utils/read-people.ts +0 -48
  285. package/src/logic-functions/utils/resolve-logic-function-id.ts +0 -11
  286. package/src/logic-functions/utils/resolve-min-likelihood.ts +0 -12
  287. package/src/logic-functions/utils/resolve-update-fields-mode.ts +0 -16
  288. package/src/logic-functions/utils/run-batch-enrichment.ts +0 -50
  289. package/src/logic-functions/utils/run-single-enrichment.ts +0 -44
  290. package/src/logic-functions/utils/salary-transform.ts +0 -18
  291. package/src/logic-functions/utils/seed-enrichment-workflow.ts +0 -131
  292. package/src/logic-functions/utils/size-transform.ts +0 -15
  293. package/src/logic-functions/utils/to-bulk-enrich-input.ts +0 -14
  294. package/src/logic-functions/utils/to-json-array.ts +0 -4
  295. package/src/logic-functions/utils/to-json-object.ts +0 -22
  296. package/src/logic-functions/utils/to-number.ts +0 -4
  297. package/src/logic-functions/utils/to-string-array.ts +0 -28
  298. package/src/logic-functions/utils/to-text.ts +0 -11
  299. package/src/logic-functions/utils/update-companies-status.ts +0 -18
  300. package/src/logic-functions/utils/update-company-record.ts +0 -15
  301. package/src/logic-functions/utils/update-people-status.ts +0 -18
  302. package/src/logic-functions/utils/update-person-record.ts +0 -15
  303. package/src/roles/default-function.role.ts +0 -41
  304. package/src/types/address-parts.ts +0 -9
  305. package/src/types/address-value.ts +0 -10
  306. package/src/types/batch-enrichment-adapter.ts +0 -43
  307. package/src/types/bulk-enrich-input.ts +0 -9
  308. package/src/types/bulk-enrich-result.ts +0 -11
  309. package/src/types/company-id-by-match-key-cache.ts +0 -1
  310. package/src/types/company-match-keys.ts +0 -6
  311. package/src/types/company-node.ts +0 -16
  312. package/src/types/currency-value.ts +0 -4
  313. package/src/types/emails-value.ts +0 -4
  314. package/src/types/enrich-result.ts +0 -11
  315. package/src/types/enrich-status.ts +0 -1
  316. package/src/types/enrichment-workflow-seed.ts +0 -9
  317. package/src/types/full-name-value.ts +0 -4
  318. package/src/types/links-value.ts +0 -5
  319. package/src/types/mapped-record.ts +0 -4
  320. package/src/types/pdl-company-data.ts +0 -50
  321. package/src/types/pdl-company-enrich-params.ts +0 -7
  322. package/src/types/pdl-enrich-result.ts +0 -4
  323. package/src/types/pdl-person-data.ts +0 -65
  324. package/src/types/pdl-person-enrich-params.ts +0 -8
  325. package/src/types/person-node.ts +0 -11
  326. package/src/types/phones-value.ts +0 -12
  327. package/src/types/post-install-result.ts +0 -5
  328. package/src/types/seed-enrichment-workflow-result.ts +0 -7
  329. package/src/types/select-option-meta.ts +0 -9
  330. package/src/types/single-enrich-input.ts +0 -7
  331. package/src/types/tag-color.ts +0 -26
  332. package/src/types/update-fields-option.ts +0 -4
  333. package/src/types/workflow-bulk-records-trigger.ts +0 -15
  334. package/src/types/workflow-logic-function-step.ts +0 -18
  335. package/src/utils/__tests__/build-select-options.spec.ts +0 -20
  336. package/src/utils/__tests__/is-defined.spec.ts +0 -16
  337. package/src/utils/__tests__/is-unique-violation-error.spec.ts +0 -71
  338. package/src/utils/__tests__/normalize-enum-value.spec.ts +0 -28
  339. package/src/utils/__tests__/prune-undefined.spec.ts +0 -22
  340. package/src/utils/__tests__/strip-separators.spec.ts +0 -13
  341. package/src/utils/__tests__/to-error-message.spec.ts +0 -13
  342. package/src/utils/build-select-options.ts +0 -16
  343. package/src/utils/is-defined.ts +0 -5
  344. package/src/utils/is-unique-violation-error.ts +0 -74
  345. package/src/utils/normalize-enum-value.ts +0 -15
  346. package/src/utils/prune-undefined.ts +0 -15
  347. package/src/utils/strip-separators.ts +0 -4
  348. package/src/utils/to-error-message.ts +0 -2
  349. package/src/views/enriched-companies.view.ts +0 -69
  350. package/src/views/enriched-people.view.ts +0 -74
  351. package/tsconfig.json +0 -42
  352. package/tsconfig.spec.json +0 -9
  353. package/vitest.config.ts +0 -31
  354. package/vitest.unit.config.ts +0 -14
@@ -1,15 +0,0 @@
1
- import { companyEnrichmentAdapter } from 'src/logic-functions/handlers/company-enrichment-adapter';
2
- import { enrichCompany } from 'src/logic-functions/utils/enrich-company';
3
- import { type BatchEnrichmentAdapter } from 'src/types/batch-enrichment-adapter';
4
- import { type CompanyNode } from 'src/types/company-node';
5
- import { type PdlCompanyData } from 'src/types/pdl-company-data';
6
- import { type PdlCompanyEnrichParams } from 'src/types/pdl-company-enrich-params';
7
-
8
- export const companySingleEnrichmentAdapter: BatchEnrichmentAdapter<
9
- CompanyNode,
10
- PdlCompanyData,
11
- PdlCompanyEnrichParams
12
- > = {
13
- ...companyEnrichmentAdapter,
14
- enrichBatch: enrichCompany,
15
- };
@@ -1,15 +0,0 @@
1
- import { CoreApiClient } from 'twenty-client-sdk/core';
2
-
3
- import { companyEnrichmentAdapter } from 'src/logic-functions/handlers/company-enrichment-adapter';
4
- import { runBatchEnrichment } from 'src/logic-functions/utils/run-batch-enrichment';
5
- import { type BulkEnrichInput } from 'src/types/bulk-enrich-input';
6
- import { type BulkEnrichResult } from 'src/types/bulk-enrich-result';
7
-
8
- export const enrichCompaniesCore = ({
9
- input,
10
- client = new CoreApiClient(),
11
- }: {
12
- input: BulkEnrichInput;
13
- client?: CoreApiClient;
14
- }): Promise<BulkEnrichResult> =>
15
- runBatchEnrichment({ client, input, adapter: companyEnrichmentAdapter });
@@ -1,19 +0,0 @@
1
- import { CoreApiClient } from 'twenty-client-sdk/core';
2
-
3
- import { companySingleEnrichmentAdapter } from 'src/logic-functions/handlers/company-single-enrichment-adapter';
4
- import { runSingleEnrichment } from 'src/logic-functions/utils/run-single-enrichment';
5
- import { type EnrichResult } from 'src/types/enrich-result';
6
- import { type SingleEnrichInput } from 'src/types/single-enrich-input';
7
-
8
- export const enrichCompanyCore = ({
9
- input,
10
- client = new CoreApiClient(),
11
- }: {
12
- input: SingleEnrichInput;
13
- client?: CoreApiClient;
14
- }): Promise<EnrichResult> =>
15
- runSingleEnrichment({
16
- client,
17
- input,
18
- adapter: companySingleEnrichmentAdapter,
19
- });
@@ -1,15 +0,0 @@
1
- import { CoreApiClient } from 'twenty-client-sdk/core';
2
-
3
- import { personEnrichmentAdapter } from 'src/logic-functions/handlers/person-enrichment-adapter';
4
- import { runBatchEnrichment } from 'src/logic-functions/utils/run-batch-enrichment';
5
- import { type BulkEnrichInput } from 'src/types/bulk-enrich-input';
6
- import { type BulkEnrichResult } from 'src/types/bulk-enrich-result';
7
-
8
- export const enrichPeopleCore = ({
9
- input,
10
- client = new CoreApiClient(),
11
- }: {
12
- input: BulkEnrichInput;
13
- client?: CoreApiClient;
14
- }): Promise<BulkEnrichResult> =>
15
- runBatchEnrichment({ client, input, adapter: personEnrichmentAdapter });
@@ -1,19 +0,0 @@
1
- import { CoreApiClient } from 'twenty-client-sdk/core';
2
-
3
- import { personSingleEnrichmentAdapter } from 'src/logic-functions/handlers/person-single-enrichment-adapter';
4
- import { runSingleEnrichment } from 'src/logic-functions/utils/run-single-enrichment';
5
- import { type EnrichResult } from 'src/types/enrich-result';
6
- import { type SingleEnrichInput } from 'src/types/single-enrich-input';
7
-
8
- export const enrichPersonCore = ({
9
- input,
10
- client = new CoreApiClient(),
11
- }: {
12
- input: SingleEnrichInput;
13
- client?: CoreApiClient;
14
- }): Promise<EnrichResult> =>
15
- runSingleEnrichment({
16
- client,
17
- input,
18
- adapter: personSingleEnrichmentAdapter,
19
- });
@@ -1,29 +0,0 @@
1
- import { PERSON_MATCH_COST_DOLLARS } from 'src/constants/person-match-cost-dollars';
2
- import { buildPersonMatchedData } from 'src/logic-functions/utils/build-person-matched-data';
3
- import { enrichPeople } from 'src/logic-functions/utils/enrich-people';
4
- import { extractPersonMatchParams } from 'src/logic-functions/utils/extract-person-match-params';
5
- import { readPeople } from 'src/logic-functions/utils/read-people';
6
- import { updatePeopleStatus } from 'src/logic-functions/utils/update-people-status';
7
- import { updatePersonRecord } from 'src/logic-functions/utils/update-person-record';
8
- import { type BatchEnrichmentAdapter } from 'src/types/batch-enrichment-adapter';
9
- import { type PdlPersonData } from 'src/types/pdl-person-data';
10
- import { type PdlPersonEnrichParams } from 'src/types/pdl-person-enrich-params';
11
- import { type PersonNode } from 'src/types/person-node';
12
-
13
- export const personEnrichmentAdapter: BatchEnrichmentAdapter<
14
- PersonNode,
15
- PdlPersonData,
16
- PdlPersonEnrichParams
17
- > = {
18
- objectNameSingular: 'Person',
19
- noIdentifierMessage:
20
- 'No usable identifier (email, LinkedIn, PDL id, or name paired with a company) to match against PDL.',
21
- costPerMatchDollars: PERSON_MATCH_COST_DOLLARS,
22
- readRecords: readPeople,
23
- getNodeId: (node) => node.id,
24
- extractParams: extractPersonMatchParams,
25
- enrichBatch: enrichPeople,
26
- buildMatchedData: buildPersonMatchedData,
27
- updateOne: updatePersonRecord,
28
- updateManyStatus: updatePeopleStatus,
29
- };
@@ -1,15 +0,0 @@
1
- import { personEnrichmentAdapter } from 'src/logic-functions/handlers/person-enrichment-adapter';
2
- import { enrichPerson } from 'src/logic-functions/utils/enrich-person';
3
- import { type BatchEnrichmentAdapter } from 'src/types/batch-enrichment-adapter';
4
- import { type PdlPersonData } from 'src/types/pdl-person-data';
5
- import { type PdlPersonEnrichParams } from 'src/types/pdl-person-enrich-params';
6
- import { type PersonNode } from 'src/types/person-node';
7
-
8
- export const personSingleEnrichmentAdapter: BatchEnrichmentAdapter<
9
- PersonNode,
10
- PdlPersonData,
11
- PdlPersonEnrichParams
12
- > = {
13
- ...personEnrichmentAdapter,
14
- enrichBatch: enrichPerson,
15
- };
@@ -1,69 +0,0 @@
1
- import { CoreApiClient } from 'twenty-client-sdk/core';
2
- import { MetadataApiClient } from 'twenty-client-sdk/metadata';
3
-
4
- import { ENRICHMENT_WORKFLOW_SEEDS } from 'src/constants/enrichment-workflow-seeds';
5
- import { resolveLogicFunctionId } from 'src/logic-functions/utils/resolve-logic-function-id';
6
- import { seedEnrichmentWorkflow } from 'src/logic-functions/utils/seed-enrichment-workflow';
7
- import { type PostInstallResult } from 'src/types/post-install-result';
8
- import { type SeedEnrichmentWorkflowResult } from 'src/types/seed-enrichment-workflow-result';
9
- import { isDefined } from 'src/utils/is-defined';
10
-
11
- export const postInstallCore = async ({
12
- coreClient = new CoreApiClient(),
13
- metadataClient = new MetadataApiClient(),
14
- }: {
15
- coreClient?: CoreApiClient;
16
- metadataClient?: MetadataApiClient;
17
- } = {}): Promise<PostInstallResult> => {
18
- const { findManyLogicFunctions: logicFunctions } = await metadataClient.query(
19
- {
20
- findManyLogicFunctions: {
21
- id: true,
22
- universalIdentifier: true,
23
- },
24
- },
25
- );
26
-
27
- const seededWorkflows: SeedEnrichmentWorkflowResult[] = [];
28
-
29
- for (const seed of ENRICHMENT_WORKFLOW_SEEDS) {
30
- const logicFunctionId = resolveLogicFunctionId({
31
- logicFunctions,
32
- universalIdentifier: seed.logicFunctionUniversalIdentifier,
33
- });
34
-
35
- if (!isDefined(logicFunctionId)) {
36
- console.warn(
37
- `[people-data-labs] Skipping "${seed.workflowName}": logic function ${seed.logicFunctionUniversalIdentifier} is not installed.`,
38
- );
39
- continue;
40
- }
41
-
42
- try {
43
- const result = await seedEnrichmentWorkflow({
44
- client: coreClient,
45
- logicFunctionId,
46
- seed,
47
- });
48
-
49
- seededWorkflows.push(result);
50
- } catch (error) {
51
- const errorMessage =
52
- error instanceof Error ? error.message : String(error);
53
-
54
- console.warn(
55
- `[people-data-labs] Failed to seed "${seed.workflowName}": ${errorMessage}`,
56
- error,
57
- );
58
-
59
- seededWorkflows.push({
60
- objectNameSingular: seed.objectNameSingular,
61
- workflowName: seed.workflowName,
62
- status: 'failed',
63
- error: errorMessage,
64
- });
65
- }
66
- }
67
-
68
- return { seededWorkflows };
69
- };
@@ -1,17 +0,0 @@
1
- import { definePostInstallLogicFunction } from 'twenty-sdk/define';
2
-
3
- import { PDL_LOGIC_FUNCTION_CONSTANTS } from 'src/constants/universal-identifiers';
4
-
5
- const handler = async () => {
6
- return { seededWorkflows: [] };
7
- };
8
-
9
- export default definePostInstallLogicFunction({
10
- universalIdentifier: PDL_LOGIC_FUNCTION_CONSTANTS.postInstall.universalIdentifier,
11
- name: 'post-install',
12
- description:
13
- 'Post-install hook for the People Data Labs app (workflow seeding is not currently wired up).',
14
- timeoutSeconds: 30,
15
- handler,
16
- shouldRunSynchronously: true,
17
- });
@@ -1,52 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { aggregateBulkEnrichResult } from 'src/logic-functions/utils/aggregate-bulk-enrich-result';
4
- import { type EnrichResult } from 'src/types/enrich-result';
5
-
6
- const result = (status: EnrichResult['status'], recordId: string): EnrichResult => ({
7
- success: status !== 'ERROR',
8
- recordId,
9
- status,
10
- updatedFields: [],
11
- message: 'message',
12
- });
13
-
14
- describe('aggregateBulkEnrichResult', () => {
15
- it('counts each status and flags failure when something errored', () => {
16
- expect(
17
- aggregateBulkEnrichResult([
18
- result('MATCHED', 'a'),
19
- result('NOT_FOUND', 'b'),
20
- result('SKIPPED', 'c'),
21
- result('ERROR', 'd'),
22
- ]),
23
- ).toMatchObject({
24
- total: 4,
25
- matched: 1,
26
- notFound: 1,
27
- skipped: 1,
28
- errored: 1,
29
- success: false,
30
- });
31
- });
32
-
33
- it('reports success when there are no errors', () => {
34
- expect(aggregateBulkEnrichResult([result('MATCHED', 'a')])).toMatchObject({
35
- success: true,
36
- errored: 0,
37
- total: 1,
38
- });
39
- });
40
-
41
- it('returns an empty summary for no results', () => {
42
- expect(aggregateBulkEnrichResult([])).toEqual({
43
- success: true,
44
- total: 0,
45
- matched: 0,
46
- notFound: 0,
47
- skipped: 0,
48
- errored: 0,
49
- results: [],
50
- });
51
- });
52
- });
@@ -1,30 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { buildAddress } from 'src/logic-functions/utils/build-address';
4
-
5
- describe('buildAddress', () => {
6
- it('maps parts to the address composite using addressPostcode', () => {
7
- expect(
8
- buildAddress({
9
- city: 'San Francisco',
10
- state: 'California',
11
- postcode: '94107',
12
- country: 'United States',
13
- geo: '37.77,-122.41',
14
- }),
15
- ).toEqual({
16
- addressStreet1: '',
17
- addressStreet2: '',
18
- addressCity: 'San Francisco',
19
- addressPostcode: '94107',
20
- addressState: 'California',
21
- addressCountry: 'United States',
22
- addressLat: 37.77,
23
- addressLng: -122.41,
24
- });
25
- });
26
-
27
- it('returns undefined when no part has a value', () => {
28
- expect(buildAddress({ city: '', country: null })).toBeUndefined();
29
- });
30
- });
@@ -1,16 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { buildAllowedValues } from 'src/logic-functions/utils/build-allowed-values';
4
-
5
- describe('buildAllowedValues', () => {
6
- it('builds a set of the option values', () => {
7
- const allowed = buildAllowedValues([
8
- { key: 'a', value: 'A', label: 'A', color: 'blue', position: 0 },
9
- { key: 'b', value: 'B', label: 'B', color: 'red', position: 1 },
10
- ]);
11
-
12
- expect(allowed.has('A')).toBe(true);
13
- expect(allowed.has('B')).toBe(true);
14
- expect(allowed.size).toBe(2);
15
- });
16
- });
@@ -1,26 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { buildBulkRecordsTrigger } from 'src/logic-functions/utils/build-bulk-records-trigger';
4
-
5
- describe('buildBulkRecordsTrigger', () => {
6
- it('builds a bulk-records manual trigger with no next step wired', () => {
7
- const trigger = buildBulkRecordsTrigger({
8
- objectNameSingular: 'person',
9
- name: 'When people are selected',
10
- icon: 'IconSparkles',
11
- });
12
-
13
- expect(trigger).toEqual({
14
- name: 'When people are selected',
15
- type: 'MANUAL',
16
- settings: {
17
- objectType: 'person',
18
- availability: { type: 'BULK_RECORDS', objectNameSingular: 'person' },
19
- outputSchema: {},
20
- icon: 'IconSparkles',
21
- isPinned: false,
22
- },
23
- nextStepIds: [],
24
- });
25
- });
26
- });
@@ -1,37 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { buildCompanyCreateData } from 'src/logic-functions/utils/build-company-create-data';
4
- import { type PdlPersonData } from 'src/types/pdl-person-data';
5
-
6
- describe('buildCompanyCreateData', () => {
7
- it('maps job_company_* onto Company standard and pdl fields', () => {
8
- const data = buildCompanyCreateData({
9
- job_company_id: 'pdl-co-1',
10
- job_company_name: 'Acme',
11
- job_company_website: 'acme.com',
12
- job_company_linkedin_url: 'https://linkedin.com/company/acme',
13
- job_company_industry: 'accounting',
14
- job_company_size: '11-50',
15
- } as PdlPersonData);
16
-
17
- expect(data).toMatchObject({
18
- name: 'Acme',
19
- pdlId: 'pdl-co-1',
20
- pdlIndustry: 'ACCOUNTING',
21
- pdlSizeRange: 'ELEVEN_TO_FIFTY',
22
- });
23
- expect(data.domainName).toMatchObject({ primaryLinkUrl: 'acme.com' });
24
- expect(data.linkedinLink).toMatchObject({
25
- primaryLinkUrl: 'linkedin.com/company/acme',
26
- });
27
- });
28
-
29
- it('omits fields PDL did not return and drops unknown select values', () => {
30
- const data = buildCompanyCreateData({
31
- job_company_name: 'Acme',
32
- job_company_industry: 'not-a-real-industry',
33
- } as PdlPersonData);
34
-
35
- expect(data).toEqual({ name: 'Acme' });
36
- });
37
- });
@@ -1,35 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { buildCompanyMatchKeys } from 'src/logic-functions/utils/build-company-match-keys';
4
- import { type PdlPersonData } from 'src/types/pdl-person-data';
5
-
6
- describe('buildCompanyMatchKeys', () => {
7
- it('extracts and trims the company identifiers from PDL data', () => {
8
- const keys = buildCompanyMatchKeys({
9
- job_company_id: ' pdl-co-1 ',
10
- job_company_website: 'acme.com',
11
- job_company_linkedin_url: 'https://linkedin.com/company/acme',
12
- job_company_name: 'Acme',
13
- } as PdlPersonData);
14
-
15
- expect(keys).toEqual({
16
- pdlId: 'pdl-co-1',
17
- website: 'acme.com',
18
- linkedinUrl: 'linkedin.com/company/acme',
19
- name: 'Acme',
20
- });
21
- });
22
-
23
- it('omits identifiers PDL did not return or that are blank', () => {
24
- expect(
25
- buildCompanyMatchKeys({
26
- job_company_name: ' ',
27
- job_company_website: 'acme.com',
28
- } as PdlPersonData),
29
- ).toEqual({ website: 'acme.com' });
30
- });
31
-
32
- it('returns an empty object when no company identifiers are present', () => {
33
- expect(buildCompanyMatchKeys({} as PdlPersonData)).toEqual({});
34
- });
35
- });
@@ -1,56 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { COMPANY_NODE_MOCK } from 'src/logic-functions/__mocks__/company-node.mock';
4
- import { PDL_COMPANY_DATA_MOCK } from 'src/logic-functions/__mocks__/pdl-company-data.mock';
5
- import { buildCompanyMatchedData } from 'src/logic-functions/utils/build-company-matched-data';
6
-
7
- const ENRICHED_AT = '2026-01-01T00:00:00.000Z';
8
-
9
- describe('buildCompanyMatchedData', () => {
10
- it('fills empty standard fields and always writes pdl metadata', async () => {
11
- const { mappedData, persistData } = await buildCompanyMatchedData({
12
- node: COMPANY_NODE_MOCK,
13
- outcome: { data: PDL_COMPANY_DATA_MOCK },
14
- enrichedAt: ENRICHED_AT,
15
- overrideExistingValues: false,
16
- shouldPersist: true,
17
- });
18
-
19
- expect(persistData.name).toBe('Acme Corp');
20
- expect(persistData.pdlIndustry).toBe('ACCOUNTING');
21
- expect(persistData.pdlEnrichmentStatus).toBe('MATCHED');
22
- expect(persistData.pdlLastEnrichedAt).toBe(ENRICHED_AT);
23
- expect('domainName' in persistData).toBe(false);
24
-
25
- expect(mappedData.name).toBe('Acme Corp');
26
- expect(mappedData.pdlIndustry).toBe('ACCOUNTING');
27
- expect('pdlEnrichmentStatus' in mappedData).toBe(false);
28
- expect('pdlRawPayload' in mappedData).toBe(false);
29
- });
30
-
31
- it('overwrites a populated standard field when overrideExistingValues is set', async () => {
32
- const { persistData } = await buildCompanyMatchedData({
33
- node: COMPANY_NODE_MOCK,
34
- outcome: { data: PDL_COMPANY_DATA_MOCK },
35
- enrichedAt: ENRICHED_AT,
36
- overrideExistingValues: true,
37
- shouldPersist: true,
38
- });
39
-
40
- expect('domainName' in persistData).toBe(true);
41
- });
42
-
43
- it('returns mapped data with no persist data when not persisting', async () => {
44
- const { mappedData, persistData } = await buildCompanyMatchedData({
45
- node: COMPANY_NODE_MOCK,
46
- outcome: { data: PDL_COMPANY_DATA_MOCK },
47
- enrichedAt: ENRICHED_AT,
48
- overrideExistingValues: false,
49
- shouldPersist: false,
50
- });
51
-
52
- expect(mappedData.name).toBe('Acme Corp');
53
- expect(mappedData.pdlIndustry).toBe('ACCOUNTING');
54
- expect(persistData).toEqual({});
55
- });
56
- });
@@ -1,17 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { buildCurrencyFromUsd } from 'src/logic-functions/utils/build-currency-from-usd';
4
-
5
- describe('buildCurrencyFromUsd', () => {
6
- it('converts a USD amount to micros', () => {
7
- expect(buildCurrencyFromUsd(1234.5)).toEqual({
8
- amountMicros: 1_234_500_000,
9
- currencyCode: 'USD',
10
- });
11
- });
12
-
13
- it('returns undefined for non-finite or non-number input', () => {
14
- expect(buildCurrencyFromUsd(Number.NaN)).toBeUndefined();
15
- expect(buildCurrencyFromUsd('1000')).toBeUndefined();
16
- });
17
- });
@@ -1,23 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { buildEmails } from 'src/logic-functions/utils/build-emails';
4
-
5
- describe('buildEmails', () => {
6
- it('keeps the first email as primary and the rest as additional', () => {
7
- expect(buildEmails(['work@acme.com', 'home@me.com'])).toEqual({
8
- primaryEmail: 'work@acme.com',
9
- additionalEmails: ['home@me.com'],
10
- });
11
- });
12
-
13
- it('dedupes case-insensitively and skips blanks', () => {
14
- expect(buildEmails(['work@acme.com', 'WORK@acme.com', '', null])).toEqual({
15
- primaryEmail: 'work@acme.com',
16
- additionalEmails: null,
17
- });
18
- });
19
-
20
- it('returns undefined when there are no emails', () => {
21
- expect(buildEmails([null, undefined, ''])).toBeUndefined();
22
- });
23
- });
@@ -1,16 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { buildErrorResult } from 'src/logic-functions/utils/build-error-result';
4
-
5
- describe('buildErrorResult', () => {
6
- it('builds an ERROR result carrying the error detail', () => {
7
- expect(buildErrorResult({ recordId: 'p1', error: 'boom' })).toEqual({
8
- success: false,
9
- recordId: 'p1',
10
- status: 'ERROR',
11
- updatedFields: [],
12
- message: 'People Data Labs enrichment failed.',
13
- error: 'boom',
14
- });
15
- });
16
- });
@@ -1,64 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { buildFullName } from 'src/logic-functions/utils/build-full-name';
4
-
5
- describe('buildFullName', () => {
6
- it('uses explicit first and last name when present', () => {
7
- expect(
8
- buildFullName({ firstName: 'Jane', lastName: 'Doe', fullName: undefined }),
9
- ).toEqual({
10
- firstName: 'Jane',
11
- lastName: 'Doe',
12
- });
13
- });
14
-
15
- it('fills only the part that is present', () => {
16
- expect(
17
- buildFullName({ firstName: 'Jane', lastName: undefined, fullName: undefined }),
18
- ).toEqual({
19
- firstName: 'Jane',
20
- lastName: '',
21
- });
22
- });
23
-
24
- it('splits a full name on the first whitespace run', () => {
25
- expect(
26
- buildFullName({
27
- firstName: undefined,
28
- lastName: undefined,
29
- fullName: 'Jane Mary Doe',
30
- }),
31
- ).toEqual({
32
- firstName: 'Jane',
33
- lastName: 'Mary Doe',
34
- });
35
- });
36
-
37
- it('capitalizes lowercase names returned by PDL', () => {
38
- expect(
39
- buildFullName({ firstName: 'sean', lastName: 'thorne', fullName: undefined }),
40
- ).toEqual({
41
- firstName: 'Sean',
42
- lastName: 'Thorne',
43
- });
44
- });
45
-
46
- it('capitalizes a lowercase full name when split', () => {
47
- expect(
48
- buildFullName({
49
- firstName: undefined,
50
- lastName: undefined,
51
- fullName: 'sean fong thorne',
52
- }),
53
- ).toEqual({
54
- firstName: 'Sean',
55
- lastName: 'Fong Thorne',
56
- });
57
- });
58
-
59
- it('returns undefined when there is no name', () => {
60
- expect(
61
- buildFullName({ firstName: undefined, lastName: undefined, fullName: undefined }),
62
- ).toBeUndefined();
63
- });
64
- });
@@ -1,25 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { buildLinks } from 'src/logic-functions/utils/build-links';
4
-
5
- describe('buildLinks', () => {
6
- it('builds a links value with a blank label by default', () => {
7
- expect(buildLinks({ url: 'https://acme.com' })).toEqual({
8
- primaryLinkUrl: 'https://acme.com',
9
- primaryLinkLabel: '',
10
- secondaryLinks: null,
11
- });
12
- });
13
-
14
- it('uses the provided label', () => {
15
- expect(buildLinks({ url: 'https://acme.com', label: 'Acme' })).toEqual({
16
- primaryLinkUrl: 'https://acme.com',
17
- primaryLinkLabel: 'Acme',
18
- secondaryLinks: null,
19
- });
20
- });
21
-
22
- it('returns undefined when the url is empty', () => {
23
- expect(buildLinks({ url: '' })).toBeUndefined();
24
- });
25
- });
@@ -1,33 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { buildLogicFunctionStep } from 'src/logic-functions/utils/build-logic-function-step';
4
-
5
- describe('buildLogicFunctionStep', () => {
6
- it('builds a logic-function step carrying the resolved id and input', () => {
7
- const step = buildLogicFunctionStep({
8
- id: 'step-1',
9
- name: 'Enrich with People Data Labs',
10
- logicFunctionId: 'logic-function-1',
11
- logicFunctionInput: { records: '{{trigger.companies}}' },
12
- });
13
-
14
- expect(step).toEqual({
15
- id: 'step-1',
16
- name: 'Enrich with People Data Labs',
17
- type: 'LOGIC_FUNCTION',
18
- valid: true,
19
- settings: {
20
- input: {
21
- logicFunctionId: 'logic-function-1',
22
- logicFunctionInput: { records: '{{trigger.companies}}' },
23
- },
24
- outputSchema: {},
25
- errorHandlingOptions: {
26
- retryOnFailure: { value: false },
27
- continueOnFailure: { value: false },
28
- },
29
- },
30
- nextStepIds: [],
31
- });
32
- });
33
- });