@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.
- package/manifest.json +11504 -0
- package/package.json +1 -1
- package/src/front-components/enrich-companies-component-effect.mjs +73 -0
- package/src/front-components/enrich-companies-component-effect.mjs.map +7 -0
- package/src/front-components/enrich-people-component-effect.mjs +73 -0
- package/src/front-components/enrich-people-component-effect.mjs.map +7 -0
- package/src/logic-functions/enrich-companies.function.mjs +6134 -0
- package/src/logic-functions/enrich-companies.function.mjs.map +7 -0
- package/src/logic-functions/enrich-company.function.mjs +6219 -0
- package/src/logic-functions/enrich-company.function.mjs.map +7 -0
- package/src/logic-functions/enrich-people.function.mjs +6836 -0
- package/src/logic-functions/enrich-people.function.mjs.map +7 -0
- package/src/logic-functions/enrich-person.function.mjs +6922 -0
- package/src/logic-functions/enrich-person.function.mjs.map +7 -0
- package/src/logic-functions/post-install.function.mjs +48 -0
- package/src/logic-functions/post-install.function.mjs.map +7 -0
- package/.claude/settings.local.json +0 -7
- package/.nvmrc +0 -1
- package/.oxlintrc.json +0 -58
- package/.yarnrc.yml +0 -1
- package/README.md +0 -16
- package/src/__tests__/global-setup.ts +0 -87
- package/src/__tests__/people-data-labs.integration-test.ts +0 -25
- package/src/application-config.ts +0 -18
- package/src/command-menu-items/enrich-companies.ts +0 -14
- package/src/command-menu-items/enrich-people.ts +0 -14
- package/src/constants/__tests__/select-option-constants.spec.ts +0 -142
- package/src/constants/billing-margin-multiplier.ts +0 -1
- package/src/constants/company-match-cost-dollars.ts +0 -1
- package/src/constants/company-type-options.ts +0 -46
- package/src/constants/enrichment-status-options.ts +0 -19
- package/src/constants/enrichment-workflow-seeds.ts +0 -27
- package/src/constants/funding-stage-options.ts +0 -195
- package/src/constants/industry-options.ts +0 -1033
- package/src/constants/inferred-salary-options.ts +0 -81
- package/src/constants/job-role-options.ts +0 -172
- package/src/constants/job-title-class-options.ts +0 -39
- package/src/constants/job-title-sub-role-options.ts +0 -746
- package/src/constants/location-continent-options.ts +0 -53
- package/src/constants/metro-options.ts +0 -2692
- package/src/constants/mic-exchange-options.ts +0 -494
- package/src/constants/micro-credits-per-dollar.ts +0 -1
- package/src/constants/pdl-base-url.ts +0 -1
- package/src/constants/person-match-cost-dollars.ts +0 -1
- package/src/constants/seniority-options.ts +0 -74
- package/src/constants/sex-options.ts +0 -18
- package/src/constants/size-options.ts +0 -60
- package/src/constants/universal-identifiers.ts +0 -1516
- package/src/constants/update-fields-option-values.ts +0 -5
- package/src/constants/update-fields-options.ts +0 -7
- package/src/fields/company/pdl-affiliated-profiles.field.ts +0 -20
- package/src/fields/company/pdl-alternative-domains.field.ts +0 -20
- package/src/fields/company/pdl-alternative-names.field.ts +0 -20
- package/src/fields/company/pdl-company-type.field.ts +0 -28
- package/src/fields/company/pdl-employee-count-by-country.field.ts +0 -21
- package/src/fields/company/pdl-employee-count.field.ts +0 -19
- package/src/fields/company/pdl-enrichment-status.field.ts +0 -29
- package/src/fields/company/pdl-facebook-url.field.ts +0 -19
- package/src/fields/company/pdl-founded-year.field.ts +0 -19
- package/src/fields/company/pdl-funding-stages.field.ts +0 -28
- package/src/fields/company/pdl-headline.field.ts +0 -19
- package/src/fields/company/pdl-id.field.ts +0 -19
- package/src/fields/company/pdl-industry-detail.field.ts +0 -20
- package/src/fields/company/pdl-industry.field.ts +0 -28
- package/src/fields/company/pdl-last-enriched-at.field.ts +0 -20
- package/src/fields/company/pdl-last-funding-date.field.ts +0 -20
- package/src/fields/company/pdl-latest-funding-stage.field.ts +0 -29
- package/src/fields/company/pdl-legal-name.field.ts +0 -19
- package/src/fields/company/pdl-linkedin-id.field.ts +0 -19
- package/src/fields/company/pdl-location-continent.field.ts +0 -29
- package/src/fields/company/pdl-location-metro.field.ts +0 -28
- package/src/fields/company/pdl-mic-exchange.field.ts +0 -28
- package/src/fields/company/pdl-naics.field.ts +0 -19
- package/src/fields/company/pdl-number-funding-rounds.field.ts +0 -20
- package/src/fields/company/pdl-raw-payload.field.ts +0 -19
- package/src/fields/company/pdl-sic.field.ts +0 -19
- package/src/fields/company/pdl-size-range.field.ts +0 -28
- package/src/fields/company/pdl-summary.field.ts +0 -19
- package/src/fields/company/pdl-tags.field.ts +0 -19
- package/src/fields/company/pdl-ticker.field.ts +0 -19
- package/src/fields/company/pdl-total-funding.field.ts +0 -19
- package/src/fields/company/pdl-twitter-url.field.ts +0 -19
- package/src/fields/person/pdl-birth-date.field.ts +0 -19
- package/src/fields/person/pdl-birth-year.field.ts +0 -19
- package/src/fields/person/pdl-certifications.field.ts +0 -19
- package/src/fields/person/pdl-education.field.ts +0 -19
- package/src/fields/person/pdl-enrichment-status.field.ts +0 -29
- package/src/fields/person/pdl-experience.field.ts +0 -19
- package/src/fields/person/pdl-facebook-url.field.ts +0 -19
- package/src/fields/person/pdl-github-url.field.ts +0 -19
- package/src/fields/person/pdl-headline.field.ts +0 -19
- package/src/fields/person/pdl-id.field.ts +0 -19
- package/src/fields/person/pdl-industry.field.ts +0 -28
- package/src/fields/person/pdl-inferred-salary.field.ts +0 -28
- package/src/fields/person/pdl-interests.field.ts +0 -19
- package/src/fields/person/pdl-job-onet-code.field.ts +0 -19
- package/src/fields/person/pdl-job-role.field.ts +0 -28
- package/src/fields/person/pdl-job-start-date.field.ts +0 -19
- package/src/fields/person/pdl-job-summary.field.ts +0 -19
- package/src/fields/person/pdl-job-title-class.field.ts +0 -28
- package/src/fields/person/pdl-job-title-sub-role.field.ts +0 -29
- package/src/fields/person/pdl-languages.field.ts +0 -19
- package/src/fields/person/pdl-last-enriched-at.field.ts +0 -19
- package/src/fields/person/pdl-likelihood.field.ts +0 -19
- package/src/fields/person/pdl-linkedin-connections.field.ts +0 -20
- package/src/fields/person/pdl-linkedin-username.field.ts +0 -20
- package/src/fields/person/pdl-location-metro.field.ts +0 -28
- package/src/fields/person/pdl-location.field.ts +0 -19
- package/src/fields/person/pdl-name-aliases.field.ts +0 -19
- package/src/fields/person/pdl-profiles.field.ts +0 -19
- package/src/fields/person/pdl-raw-payload.field.ts +0 -19
- package/src/fields/person/pdl-seniority.field.ts +0 -28
- package/src/fields/person/pdl-sex.field.ts +0 -28
- package/src/fields/person/pdl-skills.field.ts +0 -19
- package/src/fields/person/pdl-summary.field.ts +0 -19
- package/src/fields/person/pdl-twitter-url.field.ts +0 -19
- package/src/fields/person/pdl-years-experience.field.ts +0 -21
- package/src/front-components/enrich-companies-component-effect.tsx +0 -21
- package/src/front-components/enrich-people-component-effect.tsx +0 -21
- package/src/front-components/utils/call-enrich-logic-function.utils.ts +0 -21
- package/src/logic-functions/__mocks__/company-node.mock.ts +0 -11
- package/src/logic-functions/__mocks__/create-core-api-client-mock.ts +0 -35
- package/src/logic-functions/__mocks__/pdl-company-data.mock.ts +0 -27
- package/src/logic-functions/__mocks__/pdl-person-data.mock.ts +0 -23
- package/src/logic-functions/__mocks__/person-node.mock.ts +0 -12
- package/src/logic-functions/enrich-companies.function.ts +0 -76
- package/src/logic-functions/enrich-company.function.ts +0 -73
- package/src/logic-functions/enrich-people.function.ts +0 -76
- package/src/logic-functions/enrich-person.function.ts +0 -73
- package/src/logic-functions/errors/__tests__/pdl-config-error.spec.ts +0 -16
- package/src/logic-functions/errors/__tests__/pdl-invalid-input-error.spec.ts +0 -16
- package/src/logic-functions/errors/__tests__/pdl-operation-error.spec.ts +0 -16
- package/src/logic-functions/errors/__tests__/pdl-record-not-found-error.spec.ts +0 -21
- package/src/logic-functions/errors/pdl-config-error.ts +0 -8
- package/src/logic-functions/errors/pdl-error-code.ts +0 -8
- package/src/logic-functions/errors/pdl-error.ts +0 -12
- package/src/logic-functions/errors/pdl-invalid-input-error.ts +0 -8
- package/src/logic-functions/errors/pdl-operation-error.ts +0 -8
- package/src/logic-functions/errors/pdl-record-not-found-error.ts +0 -22
- package/src/logic-functions/handlers/__tests__/enrich-companies.spec.ts +0 -159
- package/src/logic-functions/handlers/__tests__/enrich-company.spec.ts +0 -147
- package/src/logic-functions/handlers/__tests__/enrich-people.spec.ts +0 -313
- package/src/logic-functions/handlers/__tests__/enrich-person.spec.ts +0 -198
- package/src/logic-functions/handlers/__tests__/post-install.spec.ts +0 -153
- package/src/logic-functions/handlers/company-enrichment-adapter.ts +0 -42
- package/src/logic-functions/handlers/company-single-enrichment-adapter.ts +0 -15
- package/src/logic-functions/handlers/enrich-companies.ts +0 -15
- package/src/logic-functions/handlers/enrich-company.ts +0 -19
- package/src/logic-functions/handlers/enrich-people.ts +0 -15
- package/src/logic-functions/handlers/enrich-person.ts +0 -19
- package/src/logic-functions/handlers/person-enrichment-adapter.ts +0 -29
- package/src/logic-functions/handlers/person-single-enrichment-adapter.ts +0 -15
- package/src/logic-functions/handlers/post-install.ts +0 -69
- package/src/logic-functions/post-install.function.ts +0 -17
- package/src/logic-functions/utils/__tests__/aggregate-bulk-enrich-result.spec.ts +0 -52
- package/src/logic-functions/utils/__tests__/build-address.spec.ts +0 -30
- package/src/logic-functions/utils/__tests__/build-allowed-values.spec.ts +0 -16
- package/src/logic-functions/utils/__tests__/build-bulk-records-trigger.spec.ts +0 -26
- package/src/logic-functions/utils/__tests__/build-company-create-data.spec.ts +0 -37
- package/src/logic-functions/utils/__tests__/build-company-match-keys.spec.ts +0 -35
- package/src/logic-functions/utils/__tests__/build-company-matched-data.spec.ts +0 -56
- package/src/logic-functions/utils/__tests__/build-currency-from-usd.spec.ts +0 -17
- package/src/logic-functions/utils/__tests__/build-emails.spec.ts +0 -23
- package/src/logic-functions/utils/__tests__/build-error-result.spec.ts +0 -16
- package/src/logic-functions/utils/__tests__/build-full-name.spec.ts +0 -64
- package/src/logic-functions/utils/__tests__/build-links.spec.ts +0 -25
- package/src/logic-functions/utils/__tests__/build-logic-function-step.spec.ts +0 -33
- package/src/logic-functions/utils/__tests__/build-matched-result.spec.ts +0 -33
- package/src/logic-functions/utils/__tests__/build-not-found-result.spec.ts +0 -15
- package/src/logic-functions/utils/__tests__/build-person-matched-data.spec.ts +0 -117
- package/src/logic-functions/utils/__tests__/build-person-name-param.spec.ts +0 -17
- package/src/logic-functions/utils/__tests__/build-phones.spec.ts +0 -32
- package/src/logic-functions/utils/__tests__/build-skipped-result.spec.ts +0 -17
- package/src/logic-functions/utils/__tests__/capitalize-name.spec.ts +0 -26
- package/src/logic-functions/utils/__tests__/capitalize-name.test.ts +0 -17
- package/src/logic-functions/utils/__tests__/charge-matched-enrichments.spec.ts +0 -56
- package/src/logic-functions/utils/__tests__/chunk.spec.ts +0 -25
- package/src/logic-functions/utils/__tests__/enrich-companies.spec.ts +0 -26
- package/src/logic-functions/utils/__tests__/enrich-company.spec.ts +0 -54
- package/src/logic-functions/utils/__tests__/enrich-people.spec.ts +0 -32
- package/src/logic-functions/utils/__tests__/enrich-person.spec.ts +0 -62
- package/src/logic-functions/utils/__tests__/extract-company-match-params.spec.ts +0 -86
- package/src/logic-functions/utils/__tests__/extract-pdl-error-message.spec.ts +0 -17
- package/src/logic-functions/utils/__tests__/extract-person-match-params.spec.ts +0 -75
- package/src/logic-functions/utils/__tests__/extract-record-ids.spec.ts +0 -32
- package/src/logic-functions/utils/__tests__/find-company-id-by-filter.spec.ts +0 -42
- package/src/logic-functions/utils/__tests__/find-company-id.spec.ts +0 -118
- package/src/logic-functions/utils/__tests__/find-existing-workflow-id.spec.ts +0 -26
- package/src/logic-functions/utils/__tests__/find-or-create-current-company.spec.ts +0 -203
- package/src/logic-functions/utils/__tests__/get-pdl-api-key.spec.ts +0 -38
- package/src/logic-functions/utils/__tests__/is-empty-address.spec.ts +0 -20
- package/src/logic-functions/utils/__tests__/is-empty-emails.spec.ts +0 -14
- package/src/logic-functions/utils/__tests__/is-empty-full-name.spec.ts +0 -14
- package/src/logic-functions/utils/__tests__/is-empty-links.spec.ts +0 -14
- package/src/logic-functions/utils/__tests__/is-empty-phones.spec.ts +0 -14
- package/src/logic-functions/utils/__tests__/is-empty-text.spec.ts +0 -15
- package/src/logic-functions/utils/__tests__/map-company.spec.ts +0 -48
- package/src/logic-functions/utils/__tests__/map-person.spec.ts +0 -81
- package/src/logic-functions/utils/__tests__/normalize-domain.spec.ts +0 -19
- package/src/logic-functions/utils/__tests__/normalize-linkedin-url.spec.ts +0 -22
- package/src/logic-functions/utils/__tests__/now-iso.spec.ts +0 -9
- package/src/logic-functions/utils/__tests__/parse-geo.spec.ts +0 -21
- package/src/logic-functions/utils/__tests__/parse-partial-date.spec.ts +0 -29
- package/src/logic-functions/utils/__tests__/parse-pdl-item.spec.ts +0 -88
- package/src/logic-functions/utils/__tests__/pick-multi-select.spec.ts +0 -28
- package/src/logic-functions/utils/__tests__/pick-select.spec.ts +0 -38
- package/src/logic-functions/utils/__tests__/pick-writable-standard.spec.ts +0 -37
- package/src/logic-functions/utils/__tests__/post-pdl-enrich.spec.ts +0 -192
- package/src/logic-functions/utils/__tests__/post-pdl-single-enrich.spec.ts +0 -172
- package/src/logic-functions/utils/__tests__/read-companies.spec.ts +0 -39
- package/src/logic-functions/utils/__tests__/read-people.spec.ts +0 -40
- package/src/logic-functions/utils/__tests__/resolve-logic-function-id.spec.ts +0 -25
- package/src/logic-functions/utils/__tests__/resolve-update-fields-mode.spec.ts +0 -34
- package/src/logic-functions/utils/__tests__/run-batch-enrichment.spec.ts +0 -524
- package/src/logic-functions/utils/__tests__/salary-transform.spec.ts +0 -15
- package/src/logic-functions/utils/__tests__/seed-enrichment-workflow.spec.ts +0 -136
- package/src/logic-functions/utils/__tests__/size-transform.spec.ts +0 -18
- package/src/logic-functions/utils/__tests__/to-json-array.spec.ts +0 -16
- package/src/logic-functions/utils/__tests__/to-json-object.spec.ts +0 -18
- package/src/logic-functions/utils/__tests__/to-number.spec.ts +0 -17
- package/src/logic-functions/utils/__tests__/to-string-array.spec.ts +0 -17
- package/src/logic-functions/utils/__tests__/to-text.spec.ts +0 -20
- package/src/logic-functions/utils/__tests__/update-companies-status.spec.ts +0 -32
- package/src/logic-functions/utils/__tests__/update-company-record.spec.ts +0 -25
- package/src/logic-functions/utils/__tests__/update-people-status.spec.ts +0 -32
- package/src/logic-functions/utils/__tests__/update-person-record.spec.ts +0 -25
- package/src/logic-functions/utils/aggregate-bulk-enrich-result.ts +0 -21
- package/src/logic-functions/utils/build-address.ts +0 -40
- package/src/logic-functions/utils/build-allowed-values.ts +0 -5
- package/src/logic-functions/utils/build-bulk-records-trigger.ts +0 -25
- package/src/logic-functions/utils/build-company-create-data.ts +0 -35
- package/src/logic-functions/utils/build-company-match-keys.ts +0 -16
- package/src/logic-functions/utils/build-company-matched-data.ts +0 -56
- package/src/logic-functions/utils/build-currency-from-usd.ts +0 -16
- package/src/logic-functions/utils/build-emails.ts +0 -34
- package/src/logic-functions/utils/build-error-result.ts +0 -18
- package/src/logic-functions/utils/build-full-name.ts +0 -38
- package/src/logic-functions/utils/build-links.ts +0 -23
- package/src/logic-functions/utils/build-logic-function-step.ts +0 -30
- package/src/logic-functions/utils/build-matched-result.ts +0 -21
- package/src/logic-functions/utils/build-not-found-result.ts +0 -9
- package/src/logic-functions/utils/build-person-matched-data.ts +0 -78
- package/src/logic-functions/utils/build-person-name-param.ts +0 -19
- package/src/logic-functions/utils/build-phones.ts +0 -40
- package/src/logic-functions/utils/build-skipped-result.ts +0 -15
- package/src/logic-functions/utils/capitalize-name.ts +0 -8
- package/src/logic-functions/utils/charge-matched-enrichments.ts +0 -29
- package/src/logic-functions/utils/chunk.ts +0 -18
- package/src/logic-functions/utils/enrich-chunk.ts +0 -361
- package/src/logic-functions/utils/enrich-companies.ts +0 -21
- package/src/logic-functions/utils/enrich-company.ts +0 -23
- package/src/logic-functions/utils/enrich-people.ts +0 -22
- package/src/logic-functions/utils/enrich-person.ts +0 -24
- package/src/logic-functions/utils/extract-company-match-params.ts +0 -52
- package/src/logic-functions/utils/extract-pdl-error-message.ts +0 -47
- package/src/logic-functions/utils/extract-person-match-params.ts +0 -59
- package/src/logic-functions/utils/extract-record-ids.ts +0 -18
- package/src/logic-functions/utils/find-company-id-by-filter.ts +0 -28
- package/src/logic-functions/utils/find-company-id.ts +0 -59
- package/src/logic-functions/utils/find-existing-workflow-id.ts +0 -18
- package/src/logic-functions/utils/find-or-create-current-company.ts +0 -108
- package/src/logic-functions/utils/get-pdl-api-key.ts +0 -15
- package/src/logic-functions/utils/internal-field-names.ts +0 -6
- package/src/logic-functions/utils/is-empty-address.ts +0 -20
- package/src/logic-functions/utils/is-empty-emails.ts +0 -13
- package/src/logic-functions/utils/is-empty-full-name.ts +0 -13
- package/src/logic-functions/utils/is-empty-links.ts +0 -13
- package/src/logic-functions/utils/is-empty-phones.ts +0 -13
- package/src/logic-functions/utils/is-empty-text.ts +0 -4
- package/src/logic-functions/utils/map-company.ts +0 -115
- package/src/logic-functions/utils/map-person.ts +0 -136
- package/src/logic-functions/utils/normalize-domain.ts +0 -22
- package/src/logic-functions/utils/normalize-linkedin-url.ts +0 -23
- package/src/logic-functions/utils/now-iso.ts +0 -1
- package/src/logic-functions/utils/parse-geo.ts +0 -33
- package/src/logic-functions/utils/parse-partial-date.ts +0 -33
- package/src/logic-functions/utils/parse-pdl-item.ts +0 -82
- package/src/logic-functions/utils/pick-multi-select.ts +0 -32
- package/src/logic-functions/utils/pick-select.ts +0 -30
- package/src/logic-functions/utils/pick-writable-standard.ts +0 -27
- package/src/logic-functions/utils/post-pdl-enrich.ts +0 -89
- package/src/logic-functions/utils/post-pdl-single-enrich.ts +0 -59
- package/src/logic-functions/utils/read-companies.ts +0 -53
- package/src/logic-functions/utils/read-people.ts +0 -48
- package/src/logic-functions/utils/resolve-logic-function-id.ts +0 -11
- package/src/logic-functions/utils/resolve-min-likelihood.ts +0 -12
- package/src/logic-functions/utils/resolve-update-fields-mode.ts +0 -16
- package/src/logic-functions/utils/run-batch-enrichment.ts +0 -50
- package/src/logic-functions/utils/run-single-enrichment.ts +0 -44
- package/src/logic-functions/utils/salary-transform.ts +0 -18
- package/src/logic-functions/utils/seed-enrichment-workflow.ts +0 -131
- package/src/logic-functions/utils/size-transform.ts +0 -15
- package/src/logic-functions/utils/to-bulk-enrich-input.ts +0 -14
- package/src/logic-functions/utils/to-json-array.ts +0 -4
- package/src/logic-functions/utils/to-json-object.ts +0 -22
- package/src/logic-functions/utils/to-number.ts +0 -4
- package/src/logic-functions/utils/to-string-array.ts +0 -28
- package/src/logic-functions/utils/to-text.ts +0 -11
- package/src/logic-functions/utils/update-companies-status.ts +0 -18
- package/src/logic-functions/utils/update-company-record.ts +0 -15
- package/src/logic-functions/utils/update-people-status.ts +0 -18
- package/src/logic-functions/utils/update-person-record.ts +0 -15
- package/src/roles/default-function.role.ts +0 -41
- package/src/types/address-parts.ts +0 -9
- package/src/types/address-value.ts +0 -10
- package/src/types/batch-enrichment-adapter.ts +0 -43
- package/src/types/bulk-enrich-input.ts +0 -9
- package/src/types/bulk-enrich-result.ts +0 -11
- package/src/types/company-id-by-match-key-cache.ts +0 -1
- package/src/types/company-match-keys.ts +0 -6
- package/src/types/company-node.ts +0 -16
- package/src/types/currency-value.ts +0 -4
- package/src/types/emails-value.ts +0 -4
- package/src/types/enrich-result.ts +0 -11
- package/src/types/enrich-status.ts +0 -1
- package/src/types/enrichment-workflow-seed.ts +0 -9
- package/src/types/full-name-value.ts +0 -4
- package/src/types/links-value.ts +0 -5
- package/src/types/mapped-record.ts +0 -4
- package/src/types/pdl-company-data.ts +0 -50
- package/src/types/pdl-company-enrich-params.ts +0 -7
- package/src/types/pdl-enrich-result.ts +0 -4
- package/src/types/pdl-person-data.ts +0 -65
- package/src/types/pdl-person-enrich-params.ts +0 -8
- package/src/types/person-node.ts +0 -11
- package/src/types/phones-value.ts +0 -12
- package/src/types/post-install-result.ts +0 -5
- package/src/types/seed-enrichment-workflow-result.ts +0 -7
- package/src/types/select-option-meta.ts +0 -9
- package/src/types/single-enrich-input.ts +0 -7
- package/src/types/tag-color.ts +0 -26
- package/src/types/update-fields-option.ts +0 -4
- package/src/types/workflow-bulk-records-trigger.ts +0 -15
- package/src/types/workflow-logic-function-step.ts +0 -18
- package/src/utils/__tests__/build-select-options.spec.ts +0 -20
- package/src/utils/__tests__/is-defined.spec.ts +0 -16
- package/src/utils/__tests__/is-unique-violation-error.spec.ts +0 -71
- package/src/utils/__tests__/normalize-enum-value.spec.ts +0 -28
- package/src/utils/__tests__/prune-undefined.spec.ts +0 -22
- package/src/utils/__tests__/strip-separators.spec.ts +0 -13
- package/src/utils/__tests__/to-error-message.spec.ts +0 -13
- package/src/utils/build-select-options.ts +0 -16
- package/src/utils/is-defined.ts +0 -5
- package/src/utils/is-unique-violation-error.ts +0 -74
- package/src/utils/normalize-enum-value.ts +0 -15
- package/src/utils/prune-undefined.ts +0 -15
- package/src/utils/strip-separators.ts +0 -4
- package/src/utils/to-error-message.ts +0 -2
- package/src/views/enriched-companies.view.ts +0 -69
- package/src/views/enriched-people.view.ts +0 -74
- package/tsconfig.json +0 -42
- package/tsconfig.spec.json +0 -9
- package/vitest.config.ts +0 -31
- 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
|
-
});
|