@twentyhq/people-data-labs 1.0.0
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/.claude/settings.local.json +7 -0
- package/.nvmrc +1 -0
- package/.oxlintrc.json +58 -0
- package/.yarnrc.yml +1 -0
- package/README.md +16 -0
- package/package.json +37 -0
- package/public/gallery/cover.png +0 -0
- package/public/people-data-labs-icon.png +0 -0
- package/src/__tests__/global-setup.ts +87 -0
- package/src/__tests__/people-data-labs.integration-test.ts +25 -0
- package/src/application-config.ts +18 -0
- package/src/command-menu-items/enrich-companies.ts +14 -0
- package/src/command-menu-items/enrich-people.ts +14 -0
- package/src/constants/__tests__/select-option-constants.spec.ts +142 -0
- package/src/constants/billing-margin-multiplier.ts +1 -0
- package/src/constants/company-match-cost-dollars.ts +1 -0
- package/src/constants/company-type-options.ts +46 -0
- package/src/constants/enrichment-status-options.ts +19 -0
- package/src/constants/enrichment-workflow-seeds.ts +27 -0
- package/src/constants/funding-stage-options.ts +195 -0
- package/src/constants/industry-options.ts +1033 -0
- package/src/constants/inferred-salary-options.ts +81 -0
- package/src/constants/job-role-options.ts +172 -0
- package/src/constants/job-title-class-options.ts +39 -0
- package/src/constants/job-title-sub-role-options.ts +746 -0
- package/src/constants/location-continent-options.ts +53 -0
- package/src/constants/metro-options.ts +2692 -0
- package/src/constants/mic-exchange-options.ts +494 -0
- package/src/constants/micro-credits-per-dollar.ts +1 -0
- package/src/constants/pdl-base-url.ts +1 -0
- package/src/constants/person-match-cost-dollars.ts +1 -0
- package/src/constants/seniority-options.ts +74 -0
- package/src/constants/sex-options.ts +18 -0
- package/src/constants/size-options.ts +60 -0
- package/src/constants/universal-identifiers.ts +1516 -0
- package/src/constants/update-fields-option-values.ts +5 -0
- package/src/constants/update-fields-options.ts +7 -0
- package/src/fields/company/pdl-affiliated-profiles.field.ts +20 -0
- package/src/fields/company/pdl-alternative-domains.field.ts +20 -0
- package/src/fields/company/pdl-alternative-names.field.ts +20 -0
- package/src/fields/company/pdl-company-type.field.ts +28 -0
- package/src/fields/company/pdl-employee-count-by-country.field.ts +21 -0
- package/src/fields/company/pdl-employee-count.field.ts +19 -0
- package/src/fields/company/pdl-enrichment-status.field.ts +29 -0
- package/src/fields/company/pdl-facebook-url.field.ts +19 -0
- package/src/fields/company/pdl-founded-year.field.ts +19 -0
- package/src/fields/company/pdl-funding-stages.field.ts +28 -0
- package/src/fields/company/pdl-headline.field.ts +19 -0
- package/src/fields/company/pdl-id.field.ts +19 -0
- package/src/fields/company/pdl-industry-detail.field.ts +20 -0
- package/src/fields/company/pdl-industry.field.ts +28 -0
- package/src/fields/company/pdl-last-enriched-at.field.ts +20 -0
- package/src/fields/company/pdl-last-funding-date.field.ts +20 -0
- package/src/fields/company/pdl-latest-funding-stage.field.ts +29 -0
- package/src/fields/company/pdl-legal-name.field.ts +19 -0
- package/src/fields/company/pdl-linkedin-id.field.ts +19 -0
- package/src/fields/company/pdl-location-continent.field.ts +29 -0
- package/src/fields/company/pdl-location-metro.field.ts +28 -0
- package/src/fields/company/pdl-mic-exchange.field.ts +28 -0
- package/src/fields/company/pdl-naics.field.ts +19 -0
- package/src/fields/company/pdl-number-funding-rounds.field.ts +20 -0
- package/src/fields/company/pdl-raw-payload.field.ts +19 -0
- package/src/fields/company/pdl-sic.field.ts +19 -0
- package/src/fields/company/pdl-size-range.field.ts +28 -0
- package/src/fields/company/pdl-summary.field.ts +19 -0
- package/src/fields/company/pdl-tags.field.ts +19 -0
- package/src/fields/company/pdl-ticker.field.ts +19 -0
- package/src/fields/company/pdl-total-funding.field.ts +19 -0
- package/src/fields/company/pdl-twitter-url.field.ts +19 -0
- package/src/fields/person/pdl-birth-date.field.ts +19 -0
- package/src/fields/person/pdl-birth-year.field.ts +19 -0
- package/src/fields/person/pdl-certifications.field.ts +19 -0
- package/src/fields/person/pdl-education.field.ts +19 -0
- package/src/fields/person/pdl-enrichment-status.field.ts +29 -0
- package/src/fields/person/pdl-experience.field.ts +19 -0
- package/src/fields/person/pdl-facebook-url.field.ts +19 -0
- package/src/fields/person/pdl-github-url.field.ts +19 -0
- package/src/fields/person/pdl-headline.field.ts +19 -0
- package/src/fields/person/pdl-id.field.ts +19 -0
- package/src/fields/person/pdl-industry.field.ts +28 -0
- package/src/fields/person/pdl-inferred-salary.field.ts +28 -0
- package/src/fields/person/pdl-interests.field.ts +19 -0
- package/src/fields/person/pdl-job-onet-code.field.ts +19 -0
- package/src/fields/person/pdl-job-role.field.ts +28 -0
- package/src/fields/person/pdl-job-start-date.field.ts +19 -0
- package/src/fields/person/pdl-job-summary.field.ts +19 -0
- package/src/fields/person/pdl-job-title-class.field.ts +28 -0
- package/src/fields/person/pdl-job-title-sub-role.field.ts +29 -0
- package/src/fields/person/pdl-languages.field.ts +19 -0
- package/src/fields/person/pdl-last-enriched-at.field.ts +19 -0
- package/src/fields/person/pdl-likelihood.field.ts +19 -0
- package/src/fields/person/pdl-linkedin-connections.field.ts +20 -0
- package/src/fields/person/pdl-linkedin-username.field.ts +20 -0
- package/src/fields/person/pdl-location-metro.field.ts +28 -0
- package/src/fields/person/pdl-location.field.ts +19 -0
- package/src/fields/person/pdl-name-aliases.field.ts +19 -0
- package/src/fields/person/pdl-profiles.field.ts +19 -0
- package/src/fields/person/pdl-raw-payload.field.ts +19 -0
- package/src/fields/person/pdl-seniority.field.ts +28 -0
- package/src/fields/person/pdl-sex.field.ts +28 -0
- package/src/fields/person/pdl-skills.field.ts +19 -0
- package/src/fields/person/pdl-summary.field.ts +19 -0
- package/src/fields/person/pdl-twitter-url.field.ts +19 -0
- package/src/fields/person/pdl-years-experience.field.ts +21 -0
- package/src/front-components/enrich-companies-component-effect.tsx +21 -0
- package/src/front-components/enrich-people-component-effect.tsx +21 -0
- package/src/front-components/utils/call-enrich-logic-function.utils.ts +21 -0
- package/src/logic-functions/__mocks__/company-node.mock.ts +11 -0
- package/src/logic-functions/__mocks__/create-core-api-client-mock.ts +35 -0
- package/src/logic-functions/__mocks__/pdl-company-data.mock.ts +27 -0
- package/src/logic-functions/__mocks__/pdl-person-data.mock.ts +23 -0
- package/src/logic-functions/__mocks__/person-node.mock.ts +12 -0
- package/src/logic-functions/enrich-companies.function.ts +76 -0
- package/src/logic-functions/enrich-company.function.ts +73 -0
- package/src/logic-functions/enrich-people.function.ts +76 -0
- package/src/logic-functions/enrich-person.function.ts +73 -0
- package/src/logic-functions/errors/__tests__/pdl-config-error.spec.ts +16 -0
- package/src/logic-functions/errors/__tests__/pdl-invalid-input-error.spec.ts +16 -0
- package/src/logic-functions/errors/__tests__/pdl-operation-error.spec.ts +16 -0
- package/src/logic-functions/errors/__tests__/pdl-record-not-found-error.spec.ts +21 -0
- package/src/logic-functions/errors/pdl-config-error.ts +8 -0
- package/src/logic-functions/errors/pdl-error-code.ts +8 -0
- package/src/logic-functions/errors/pdl-error.ts +12 -0
- package/src/logic-functions/errors/pdl-invalid-input-error.ts +8 -0
- package/src/logic-functions/errors/pdl-operation-error.ts +8 -0
- package/src/logic-functions/errors/pdl-record-not-found-error.ts +22 -0
- package/src/logic-functions/handlers/__tests__/enrich-companies.spec.ts +159 -0
- package/src/logic-functions/handlers/__tests__/enrich-company.spec.ts +147 -0
- package/src/logic-functions/handlers/__tests__/enrich-people.spec.ts +313 -0
- package/src/logic-functions/handlers/__tests__/enrich-person.spec.ts +198 -0
- package/src/logic-functions/handlers/__tests__/post-install.spec.ts +153 -0
- package/src/logic-functions/handlers/company-enrichment-adapter.ts +42 -0
- package/src/logic-functions/handlers/company-single-enrichment-adapter.ts +15 -0
- package/src/logic-functions/handlers/enrich-companies.ts +15 -0
- package/src/logic-functions/handlers/enrich-company.ts +19 -0
- package/src/logic-functions/handlers/enrich-people.ts +15 -0
- package/src/logic-functions/handlers/enrich-person.ts +19 -0
- package/src/logic-functions/handlers/person-enrichment-adapter.ts +29 -0
- package/src/logic-functions/handlers/person-single-enrichment-adapter.ts +15 -0
- package/src/logic-functions/handlers/post-install.ts +69 -0
- package/src/logic-functions/post-install.function.ts +17 -0
- package/src/logic-functions/utils/__tests__/aggregate-bulk-enrich-result.spec.ts +52 -0
- package/src/logic-functions/utils/__tests__/build-address.spec.ts +30 -0
- package/src/logic-functions/utils/__tests__/build-allowed-values.spec.ts +16 -0
- package/src/logic-functions/utils/__tests__/build-bulk-records-trigger.spec.ts +26 -0
- package/src/logic-functions/utils/__tests__/build-company-create-data.spec.ts +37 -0
- package/src/logic-functions/utils/__tests__/build-company-match-keys.spec.ts +35 -0
- package/src/logic-functions/utils/__tests__/build-company-matched-data.spec.ts +56 -0
- package/src/logic-functions/utils/__tests__/build-currency-from-usd.spec.ts +17 -0
- package/src/logic-functions/utils/__tests__/build-emails.spec.ts +23 -0
- package/src/logic-functions/utils/__tests__/build-error-result.spec.ts +16 -0
- package/src/logic-functions/utils/__tests__/build-full-name.spec.ts +64 -0
- package/src/logic-functions/utils/__tests__/build-links.spec.ts +25 -0
- package/src/logic-functions/utils/__tests__/build-logic-function-step.spec.ts +33 -0
- package/src/logic-functions/utils/__tests__/build-matched-result.spec.ts +33 -0
- package/src/logic-functions/utils/__tests__/build-not-found-result.spec.ts +15 -0
- package/src/logic-functions/utils/__tests__/build-person-matched-data.spec.ts +117 -0
- package/src/logic-functions/utils/__tests__/build-person-name-param.spec.ts +17 -0
- package/src/logic-functions/utils/__tests__/build-phones.spec.ts +32 -0
- package/src/logic-functions/utils/__tests__/build-skipped-result.spec.ts +17 -0
- package/src/logic-functions/utils/__tests__/capitalize-name.spec.ts +26 -0
- package/src/logic-functions/utils/__tests__/capitalize-name.test.ts +17 -0
- package/src/logic-functions/utils/__tests__/charge-matched-enrichments.spec.ts +56 -0
- package/src/logic-functions/utils/__tests__/chunk.spec.ts +25 -0
- package/src/logic-functions/utils/__tests__/enrich-companies.spec.ts +26 -0
- package/src/logic-functions/utils/__tests__/enrich-company.spec.ts +54 -0
- package/src/logic-functions/utils/__tests__/enrich-people.spec.ts +32 -0
- package/src/logic-functions/utils/__tests__/enrich-person.spec.ts +62 -0
- package/src/logic-functions/utils/__tests__/extract-company-match-params.spec.ts +86 -0
- package/src/logic-functions/utils/__tests__/extract-pdl-error-message.spec.ts +17 -0
- package/src/logic-functions/utils/__tests__/extract-person-match-params.spec.ts +75 -0
- package/src/logic-functions/utils/__tests__/extract-record-ids.spec.ts +32 -0
- package/src/logic-functions/utils/__tests__/find-company-id-by-filter.spec.ts +42 -0
- package/src/logic-functions/utils/__tests__/find-company-id.spec.ts +118 -0
- package/src/logic-functions/utils/__tests__/find-existing-workflow-id.spec.ts +26 -0
- package/src/logic-functions/utils/__tests__/find-or-create-current-company.spec.ts +203 -0
- package/src/logic-functions/utils/__tests__/get-pdl-api-key.spec.ts +38 -0
- package/src/logic-functions/utils/__tests__/is-empty-address.spec.ts +20 -0
- package/src/logic-functions/utils/__tests__/is-empty-emails.spec.ts +14 -0
- package/src/logic-functions/utils/__tests__/is-empty-full-name.spec.ts +14 -0
- package/src/logic-functions/utils/__tests__/is-empty-links.spec.ts +14 -0
- package/src/logic-functions/utils/__tests__/is-empty-phones.spec.ts +14 -0
- package/src/logic-functions/utils/__tests__/is-empty-text.spec.ts +15 -0
- package/src/logic-functions/utils/__tests__/map-company.spec.ts +48 -0
- package/src/logic-functions/utils/__tests__/map-person.spec.ts +81 -0
- package/src/logic-functions/utils/__tests__/normalize-domain.spec.ts +19 -0
- package/src/logic-functions/utils/__tests__/normalize-linkedin-url.spec.ts +22 -0
- package/src/logic-functions/utils/__tests__/now-iso.spec.ts +9 -0
- package/src/logic-functions/utils/__tests__/parse-geo.spec.ts +21 -0
- package/src/logic-functions/utils/__tests__/parse-partial-date.spec.ts +29 -0
- package/src/logic-functions/utils/__tests__/parse-pdl-item.spec.ts +88 -0
- package/src/logic-functions/utils/__tests__/pick-multi-select.spec.ts +28 -0
- package/src/logic-functions/utils/__tests__/pick-select.spec.ts +38 -0
- package/src/logic-functions/utils/__tests__/pick-writable-standard.spec.ts +37 -0
- package/src/logic-functions/utils/__tests__/post-pdl-enrich.spec.ts +192 -0
- package/src/logic-functions/utils/__tests__/post-pdl-single-enrich.spec.ts +172 -0
- package/src/logic-functions/utils/__tests__/read-companies.spec.ts +39 -0
- package/src/logic-functions/utils/__tests__/read-people.spec.ts +40 -0
- package/src/logic-functions/utils/__tests__/resolve-logic-function-id.spec.ts +25 -0
- package/src/logic-functions/utils/__tests__/resolve-update-fields-mode.spec.ts +34 -0
- package/src/logic-functions/utils/__tests__/run-batch-enrichment.spec.ts +524 -0
- package/src/logic-functions/utils/__tests__/salary-transform.spec.ts +15 -0
- package/src/logic-functions/utils/__tests__/seed-enrichment-workflow.spec.ts +136 -0
- package/src/logic-functions/utils/__tests__/size-transform.spec.ts +18 -0
- package/src/logic-functions/utils/__tests__/to-json-array.spec.ts +16 -0
- package/src/logic-functions/utils/__tests__/to-json-object.spec.ts +18 -0
- package/src/logic-functions/utils/__tests__/to-number.spec.ts +17 -0
- package/src/logic-functions/utils/__tests__/to-string-array.spec.ts +17 -0
- package/src/logic-functions/utils/__tests__/to-text.spec.ts +20 -0
- package/src/logic-functions/utils/__tests__/update-companies-status.spec.ts +32 -0
- package/src/logic-functions/utils/__tests__/update-company-record.spec.ts +25 -0
- package/src/logic-functions/utils/__tests__/update-people-status.spec.ts +32 -0
- package/src/logic-functions/utils/__tests__/update-person-record.spec.ts +25 -0
- package/src/logic-functions/utils/aggregate-bulk-enrich-result.ts +21 -0
- package/src/logic-functions/utils/build-address.ts +40 -0
- package/src/logic-functions/utils/build-allowed-values.ts +5 -0
- package/src/logic-functions/utils/build-bulk-records-trigger.ts +25 -0
- package/src/logic-functions/utils/build-company-create-data.ts +35 -0
- package/src/logic-functions/utils/build-company-match-keys.ts +16 -0
- package/src/logic-functions/utils/build-company-matched-data.ts +56 -0
- package/src/logic-functions/utils/build-currency-from-usd.ts +16 -0
- package/src/logic-functions/utils/build-emails.ts +34 -0
- package/src/logic-functions/utils/build-error-result.ts +18 -0
- package/src/logic-functions/utils/build-full-name.ts +38 -0
- package/src/logic-functions/utils/build-links.ts +23 -0
- package/src/logic-functions/utils/build-logic-function-step.ts +30 -0
- package/src/logic-functions/utils/build-matched-result.ts +21 -0
- package/src/logic-functions/utils/build-not-found-result.ts +9 -0
- package/src/logic-functions/utils/build-person-matched-data.ts +78 -0
- package/src/logic-functions/utils/build-person-name-param.ts +19 -0
- package/src/logic-functions/utils/build-phones.ts +40 -0
- package/src/logic-functions/utils/build-skipped-result.ts +15 -0
- package/src/logic-functions/utils/capitalize-name.ts +8 -0
- package/src/logic-functions/utils/charge-matched-enrichments.ts +29 -0
- package/src/logic-functions/utils/chunk.ts +18 -0
- package/src/logic-functions/utils/enrich-chunk.ts +361 -0
- package/src/logic-functions/utils/enrich-companies.ts +21 -0
- package/src/logic-functions/utils/enrich-company.ts +23 -0
- package/src/logic-functions/utils/enrich-people.ts +22 -0
- package/src/logic-functions/utils/enrich-person.ts +24 -0
- package/src/logic-functions/utils/extract-company-match-params.ts +52 -0
- package/src/logic-functions/utils/extract-pdl-error-message.ts +47 -0
- package/src/logic-functions/utils/extract-person-match-params.ts +59 -0
- package/src/logic-functions/utils/extract-record-ids.ts +18 -0
- package/src/logic-functions/utils/find-company-id-by-filter.ts +28 -0
- package/src/logic-functions/utils/find-company-id.ts +59 -0
- package/src/logic-functions/utils/find-existing-workflow-id.ts +18 -0
- package/src/logic-functions/utils/find-or-create-current-company.ts +108 -0
- package/src/logic-functions/utils/get-pdl-api-key.ts +15 -0
- package/src/logic-functions/utils/internal-field-names.ts +6 -0
- package/src/logic-functions/utils/is-empty-address.ts +20 -0
- package/src/logic-functions/utils/is-empty-emails.ts +13 -0
- package/src/logic-functions/utils/is-empty-full-name.ts +13 -0
- package/src/logic-functions/utils/is-empty-links.ts +13 -0
- package/src/logic-functions/utils/is-empty-phones.ts +13 -0
- package/src/logic-functions/utils/is-empty-text.ts +4 -0
- package/src/logic-functions/utils/map-company.ts +115 -0
- package/src/logic-functions/utils/map-person.ts +136 -0
- package/src/logic-functions/utils/normalize-domain.ts +22 -0
- package/src/logic-functions/utils/normalize-linkedin-url.ts +23 -0
- package/src/logic-functions/utils/now-iso.ts +1 -0
- package/src/logic-functions/utils/parse-geo.ts +33 -0
- package/src/logic-functions/utils/parse-partial-date.ts +33 -0
- package/src/logic-functions/utils/parse-pdl-item.ts +82 -0
- package/src/logic-functions/utils/pick-multi-select.ts +32 -0
- package/src/logic-functions/utils/pick-select.ts +30 -0
- package/src/logic-functions/utils/pick-writable-standard.ts +27 -0
- package/src/logic-functions/utils/post-pdl-enrich.ts +89 -0
- package/src/logic-functions/utils/post-pdl-single-enrich.ts +59 -0
- package/src/logic-functions/utils/read-companies.ts +53 -0
- package/src/logic-functions/utils/read-people.ts +48 -0
- package/src/logic-functions/utils/resolve-logic-function-id.ts +11 -0
- package/src/logic-functions/utils/resolve-min-likelihood.ts +12 -0
- package/src/logic-functions/utils/resolve-update-fields-mode.ts +16 -0
- package/src/logic-functions/utils/run-batch-enrichment.ts +50 -0
- package/src/logic-functions/utils/run-single-enrichment.ts +44 -0
- package/src/logic-functions/utils/salary-transform.ts +18 -0
- package/src/logic-functions/utils/seed-enrichment-workflow.ts +131 -0
- package/src/logic-functions/utils/size-transform.ts +15 -0
- package/src/logic-functions/utils/to-bulk-enrich-input.ts +14 -0
- package/src/logic-functions/utils/to-json-array.ts +4 -0
- package/src/logic-functions/utils/to-json-object.ts +22 -0
- package/src/logic-functions/utils/to-number.ts +4 -0
- package/src/logic-functions/utils/to-string-array.ts +28 -0
- package/src/logic-functions/utils/to-text.ts +11 -0
- package/src/logic-functions/utils/update-companies-status.ts +18 -0
- package/src/logic-functions/utils/update-company-record.ts +15 -0
- package/src/logic-functions/utils/update-people-status.ts +18 -0
- package/src/logic-functions/utils/update-person-record.ts +15 -0
- package/src/roles/default-function.role.ts +41 -0
- package/src/types/address-parts.ts +9 -0
- package/src/types/address-value.ts +10 -0
- package/src/types/batch-enrichment-adapter.ts +43 -0
- package/src/types/bulk-enrich-input.ts +9 -0
- package/src/types/bulk-enrich-result.ts +11 -0
- package/src/types/company-id-by-match-key-cache.ts +1 -0
- package/src/types/company-match-keys.ts +6 -0
- package/src/types/company-node.ts +16 -0
- package/src/types/currency-value.ts +4 -0
- package/src/types/emails-value.ts +4 -0
- package/src/types/enrich-result.ts +11 -0
- package/src/types/enrich-status.ts +1 -0
- package/src/types/enrichment-workflow-seed.ts +9 -0
- package/src/types/full-name-value.ts +4 -0
- package/src/types/links-value.ts +5 -0
- package/src/types/mapped-record.ts +4 -0
- package/src/types/pdl-company-data.ts +50 -0
- package/src/types/pdl-company-enrich-params.ts +7 -0
- package/src/types/pdl-enrich-result.ts +4 -0
- package/src/types/pdl-person-data.ts +65 -0
- package/src/types/pdl-person-enrich-params.ts +8 -0
- package/src/types/person-node.ts +11 -0
- package/src/types/phones-value.ts +12 -0
- package/src/types/post-install-result.ts +5 -0
- package/src/types/seed-enrichment-workflow-result.ts +7 -0
- package/src/types/select-option-meta.ts +9 -0
- package/src/types/single-enrich-input.ts +7 -0
- package/src/types/tag-color.ts +26 -0
- package/src/types/update-fields-option.ts +4 -0
- package/src/types/workflow-bulk-records-trigger.ts +15 -0
- package/src/types/workflow-logic-function-step.ts +18 -0
- package/src/utils/__tests__/build-select-options.spec.ts +20 -0
- package/src/utils/__tests__/is-defined.spec.ts +16 -0
- package/src/utils/__tests__/is-unique-violation-error.spec.ts +71 -0
- package/src/utils/__tests__/normalize-enum-value.spec.ts +28 -0
- package/src/utils/__tests__/prune-undefined.spec.ts +22 -0
- package/src/utils/__tests__/strip-separators.spec.ts +13 -0
- package/src/utils/__tests__/to-error-message.spec.ts +13 -0
- package/src/utils/build-select-options.ts +16 -0
- package/src/utils/is-defined.ts +5 -0
- package/src/utils/is-unique-violation-error.ts +74 -0
- package/src/utils/normalize-enum-value.ts +15 -0
- package/src/utils/prune-undefined.ts +15 -0
- package/src/utils/strip-separators.ts +4 -0
- package/src/utils/to-error-message.ts +2 -0
- package/src/views/enriched-companies.view.ts +69 -0
- package/src/views/enriched-people.view.ts +74 -0
- package/tsconfig.json +42 -0
- package/tsconfig.spec.json +9 -0
- package/vitest.config.ts +31 -0
- package/vitest.unit.config.ts +14 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineField,
|
|
3
|
+
FieldType,
|
|
4
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
} from 'twenty-sdk/define';
|
|
6
|
+
|
|
7
|
+
import { METRO_OPTIONS } from 'src/constants/metro-options';
|
|
8
|
+
import {
|
|
9
|
+
PDL_FIELD_UNIVERSAL_IDENTIFIERS,
|
|
10
|
+
PDL_SELECT_OPTION_UNIVERSAL_IDENTIFIERS,
|
|
11
|
+
} from 'src/constants/universal-identifiers';
|
|
12
|
+
import { buildSelectOptions } from 'src/utils/build-select-options';
|
|
13
|
+
|
|
14
|
+
export default defineField({
|
|
15
|
+
universalIdentifier: PDL_FIELD_UNIVERSAL_IDENTIFIERS.person.pdlLocationMetro,
|
|
16
|
+
objectUniversalIdentifier:
|
|
17
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
|
18
|
+
type: FieldType.SELECT,
|
|
19
|
+
name: 'pdlLocationMetro',
|
|
20
|
+
label: 'Metro Area',
|
|
21
|
+
description: 'People Data Labs canonical metro area.',
|
|
22
|
+
icon: 'IconMap2',
|
|
23
|
+
isNullable: true,
|
|
24
|
+
options: buildSelectOptions({
|
|
25
|
+
meta: METRO_OPTIONS,
|
|
26
|
+
ids: PDL_SELECT_OPTION_UNIVERSAL_IDENTIFIERS.personLocationMetro,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineField,
|
|
3
|
+
FieldType,
|
|
4
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
} from 'twenty-sdk/define';
|
|
6
|
+
|
|
7
|
+
import { PDL_FIELD_UNIVERSAL_IDENTIFIERS } from 'src/constants/universal-identifiers';
|
|
8
|
+
|
|
9
|
+
export default defineField({
|
|
10
|
+
universalIdentifier: PDL_FIELD_UNIVERSAL_IDENTIFIERS.person.pdlLocation,
|
|
11
|
+
objectUniversalIdentifier:
|
|
12
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
|
13
|
+
type: FieldType.ADDRESS,
|
|
14
|
+
name: 'pdlLocation',
|
|
15
|
+
label: 'Location',
|
|
16
|
+
description: 'Location returned by People Data Labs.',
|
|
17
|
+
icon: 'IconMapPin',
|
|
18
|
+
isNullable: true,
|
|
19
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineField,
|
|
3
|
+
FieldType,
|
|
4
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
} from 'twenty-sdk/define';
|
|
6
|
+
|
|
7
|
+
import { PDL_FIELD_UNIVERSAL_IDENTIFIERS } from 'src/constants/universal-identifiers';
|
|
8
|
+
|
|
9
|
+
export default defineField({
|
|
10
|
+
universalIdentifier: PDL_FIELD_UNIVERSAL_IDENTIFIERS.person.pdlNameAliases,
|
|
11
|
+
objectUniversalIdentifier:
|
|
12
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
|
13
|
+
type: FieldType.ARRAY,
|
|
14
|
+
name: 'pdlNameAliases',
|
|
15
|
+
label: 'Name Aliases',
|
|
16
|
+
description: 'Name aliases returned by People Data Labs.',
|
|
17
|
+
icon: 'IconSignature',
|
|
18
|
+
isNullable: true,
|
|
19
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineField,
|
|
3
|
+
FieldType,
|
|
4
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
} from 'twenty-sdk/define';
|
|
6
|
+
|
|
7
|
+
import { PDL_FIELD_UNIVERSAL_IDENTIFIERS } from 'src/constants/universal-identifiers';
|
|
8
|
+
|
|
9
|
+
export default defineField({
|
|
10
|
+
universalIdentifier: PDL_FIELD_UNIVERSAL_IDENTIFIERS.person.pdlProfiles,
|
|
11
|
+
objectUniversalIdentifier:
|
|
12
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
|
13
|
+
type: FieldType.RAW_JSON,
|
|
14
|
+
name: 'pdlProfiles',
|
|
15
|
+
label: 'Social Profiles',
|
|
16
|
+
description: 'All social profiles returned by People Data Labs.',
|
|
17
|
+
icon: 'IconUserCircle',
|
|
18
|
+
isNullable: true,
|
|
19
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineField,
|
|
3
|
+
FieldType,
|
|
4
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
} from 'twenty-sdk/define';
|
|
6
|
+
|
|
7
|
+
import { PDL_FIELD_UNIVERSAL_IDENTIFIERS } from 'src/constants/universal-identifiers';
|
|
8
|
+
|
|
9
|
+
export default defineField({
|
|
10
|
+
universalIdentifier: PDL_FIELD_UNIVERSAL_IDENTIFIERS.person.pdlRawPayload,
|
|
11
|
+
objectUniversalIdentifier:
|
|
12
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
|
13
|
+
type: FieldType.RAW_JSON,
|
|
14
|
+
name: 'pdlRawPayload',
|
|
15
|
+
label: 'PDL Raw Payload',
|
|
16
|
+
description: 'Full People Data Labs person enrichment response.',
|
|
17
|
+
icon: 'IconBraces',
|
|
18
|
+
isNullable: true,
|
|
19
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineField,
|
|
3
|
+
FieldType,
|
|
4
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
} from 'twenty-sdk/define';
|
|
6
|
+
|
|
7
|
+
import { SENIORITY_OPTIONS } from 'src/constants/seniority-options';
|
|
8
|
+
import {
|
|
9
|
+
PDL_FIELD_UNIVERSAL_IDENTIFIERS,
|
|
10
|
+
PDL_SELECT_OPTION_UNIVERSAL_IDENTIFIERS,
|
|
11
|
+
} from 'src/constants/universal-identifiers';
|
|
12
|
+
import { buildSelectOptions } from 'src/utils/build-select-options';
|
|
13
|
+
|
|
14
|
+
export default defineField({
|
|
15
|
+
universalIdentifier: PDL_FIELD_UNIVERSAL_IDENTIFIERS.person.pdlSeniority,
|
|
16
|
+
objectUniversalIdentifier:
|
|
17
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
|
18
|
+
type: FieldType.MULTI_SELECT,
|
|
19
|
+
name: 'pdlSeniority',
|
|
20
|
+
label: 'Seniority',
|
|
21
|
+
description: 'People Data Labs canonical job title levels.',
|
|
22
|
+
icon: 'IconStairsUp',
|
|
23
|
+
isNullable: true,
|
|
24
|
+
options: buildSelectOptions({
|
|
25
|
+
meta: SENIORITY_OPTIONS,
|
|
26
|
+
ids: PDL_SELECT_OPTION_UNIVERSAL_IDENTIFIERS.seniority,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineField,
|
|
3
|
+
FieldType,
|
|
4
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
} from 'twenty-sdk/define';
|
|
6
|
+
|
|
7
|
+
import { SEX_OPTIONS } from 'src/constants/sex-options';
|
|
8
|
+
import {
|
|
9
|
+
PDL_FIELD_UNIVERSAL_IDENTIFIERS,
|
|
10
|
+
PDL_SELECT_OPTION_UNIVERSAL_IDENTIFIERS,
|
|
11
|
+
} from 'src/constants/universal-identifiers';
|
|
12
|
+
import { buildSelectOptions } from 'src/utils/build-select-options';
|
|
13
|
+
|
|
14
|
+
export default defineField({
|
|
15
|
+
universalIdentifier: PDL_FIELD_UNIVERSAL_IDENTIFIERS.person.pdlSex,
|
|
16
|
+
objectUniversalIdentifier:
|
|
17
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
|
18
|
+
type: FieldType.SELECT,
|
|
19
|
+
name: 'pdlSex',
|
|
20
|
+
label: 'Sex',
|
|
21
|
+
description: 'Sex returned by People Data Labs.',
|
|
22
|
+
icon: 'IconGenderBigender',
|
|
23
|
+
isNullable: true,
|
|
24
|
+
options: buildSelectOptions({
|
|
25
|
+
meta: SEX_OPTIONS,
|
|
26
|
+
ids: PDL_SELECT_OPTION_UNIVERSAL_IDENTIFIERS.sex,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineField,
|
|
3
|
+
FieldType,
|
|
4
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
} from 'twenty-sdk/define';
|
|
6
|
+
|
|
7
|
+
import { PDL_FIELD_UNIVERSAL_IDENTIFIERS } from 'src/constants/universal-identifiers';
|
|
8
|
+
|
|
9
|
+
export default defineField({
|
|
10
|
+
universalIdentifier: PDL_FIELD_UNIVERSAL_IDENTIFIERS.person.pdlSkills,
|
|
11
|
+
objectUniversalIdentifier:
|
|
12
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
|
13
|
+
type: FieldType.ARRAY,
|
|
14
|
+
name: 'pdlSkills',
|
|
15
|
+
label: 'Skills',
|
|
16
|
+
description: 'Skills returned by People Data Labs.',
|
|
17
|
+
icon: 'IconBulb',
|
|
18
|
+
isNullable: true,
|
|
19
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineField,
|
|
3
|
+
FieldType,
|
|
4
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
} from 'twenty-sdk/define';
|
|
6
|
+
|
|
7
|
+
import { PDL_FIELD_UNIVERSAL_IDENTIFIERS } from 'src/constants/universal-identifiers';
|
|
8
|
+
|
|
9
|
+
export default defineField({
|
|
10
|
+
universalIdentifier: PDL_FIELD_UNIVERSAL_IDENTIFIERS.person.pdlSummary,
|
|
11
|
+
objectUniversalIdentifier:
|
|
12
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
|
13
|
+
type: FieldType.TEXT,
|
|
14
|
+
name: 'pdlSummary',
|
|
15
|
+
label: 'Summary',
|
|
16
|
+
description: 'Profile summary returned by People Data Labs.',
|
|
17
|
+
icon: 'IconFileText',
|
|
18
|
+
isNullable: true,
|
|
19
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineField,
|
|
3
|
+
FieldType,
|
|
4
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
} from 'twenty-sdk/define';
|
|
6
|
+
|
|
7
|
+
import { PDL_FIELD_UNIVERSAL_IDENTIFIERS } from 'src/constants/universal-identifiers';
|
|
8
|
+
|
|
9
|
+
export default defineField({
|
|
10
|
+
universalIdentifier: PDL_FIELD_UNIVERSAL_IDENTIFIERS.person.pdlTwitterUrl,
|
|
11
|
+
objectUniversalIdentifier:
|
|
12
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
|
13
|
+
type: FieldType.LINKS,
|
|
14
|
+
name: 'pdlTwitterUrl',
|
|
15
|
+
label: 'X / Twitter',
|
|
16
|
+
description: 'X or Twitter profile returned by People Data Labs.',
|
|
17
|
+
icon: 'IconBrandX',
|
|
18
|
+
isNullable: true,
|
|
19
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineField,
|
|
3
|
+
FieldType,
|
|
4
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
} from 'twenty-sdk/define';
|
|
6
|
+
|
|
7
|
+
import { PDL_FIELD_UNIVERSAL_IDENTIFIERS } from 'src/constants/universal-identifiers';
|
|
8
|
+
|
|
9
|
+
export default defineField({
|
|
10
|
+
universalIdentifier:
|
|
11
|
+
PDL_FIELD_UNIVERSAL_IDENTIFIERS.person.pdlYearsExperience,
|
|
12
|
+
objectUniversalIdentifier:
|
|
13
|
+
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
|
14
|
+
type: FieldType.NUMBER,
|
|
15
|
+
name: 'pdlYearsExperience',
|
|
16
|
+
label: 'Years of Experience',
|
|
17
|
+
description:
|
|
18
|
+
'Inferred years of professional experience from People Data Labs.',
|
|
19
|
+
icon: 'IconHourglass',
|
|
20
|
+
isNullable: true,
|
|
21
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineFrontComponent } from 'twenty-sdk/define';
|
|
2
|
+
import { Command, useSelectedRecordIds } from 'twenty-sdk/front-component';
|
|
3
|
+
import {
|
|
4
|
+
PDL_FRONT_COMPONENT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
PDL_LOGIC_FUNCTION_CONSTANTS
|
|
6
|
+
} from 'src/constants/universal-identifiers';
|
|
7
|
+
import { execute } from 'src/front-components/utils/call-enrich-logic-function.utils';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const Enrich = () => {
|
|
11
|
+
const recordIds = useSelectedRecordIds();
|
|
12
|
+
return <Command execute={() => execute({ path: PDL_LOGIC_FUNCTION_CONSTANTS.enrichCompanies.path, recordIds })} />;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default defineFrontComponent({
|
|
16
|
+
universalIdentifier: PDL_FRONT_COMPONENT_UNIVERSAL_IDENTIFIERS.enrichCompanies,
|
|
17
|
+
name: 'enrich-companies-effect',
|
|
18
|
+
description: 'Enrich companies effect',
|
|
19
|
+
component: Enrich,
|
|
20
|
+
isHeadless: true
|
|
21
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineFrontComponent } from 'twenty-sdk/define';
|
|
2
|
+
import { Command, useSelectedRecordIds } from 'twenty-sdk/front-component';
|
|
3
|
+
import {
|
|
4
|
+
PDL_FRONT_COMPONENT_UNIVERSAL_IDENTIFIERS,
|
|
5
|
+
PDL_LOGIC_FUNCTION_CONSTANTS
|
|
6
|
+
} from 'src/constants/universal-identifiers';
|
|
7
|
+
import { execute } from 'src/front-components/utils/call-enrich-logic-function.utils';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const Enrich = () => {
|
|
11
|
+
const recordIds = useSelectedRecordIds();
|
|
12
|
+
return <Command execute={() => execute({ path: PDL_LOGIC_FUNCTION_CONSTANTS.enrichPeople.path, recordIds })} />;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default defineFrontComponent({
|
|
16
|
+
universalIdentifier: PDL_FRONT_COMPONENT_UNIVERSAL_IDENTIFIERS.enrichPeople,
|
|
17
|
+
name: 'enrich-people-effect',
|
|
18
|
+
description: 'Enrich people effect',
|
|
19
|
+
component: Enrich,
|
|
20
|
+
isHeadless: true
|
|
21
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RestApiClient } from 'twenty-client-sdk/rest';
|
|
2
|
+
import { enqueueSnackbar } from 'twenty-sdk/front-component';
|
|
3
|
+
|
|
4
|
+
export const execute = async ({path, recordIds}:{ path: string; recordIds: string[] }) => {
|
|
5
|
+
try {
|
|
6
|
+
const client = new RestApiClient();
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
await client.post(`/s${path}`, { recordIds });
|
|
10
|
+
|
|
11
|
+
await enqueueSnackbar({
|
|
12
|
+
message: `Enriched ${recordIds.length > 1 ? 'records.' : 'record.'}`,
|
|
13
|
+
variant: 'success',
|
|
14
|
+
});
|
|
15
|
+
} catch {
|
|
16
|
+
await enqueueSnackbar({
|
|
17
|
+
message: 'Records enrichment failed',
|
|
18
|
+
variant: 'error',
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CompanyNode } from 'src/types/company-node';
|
|
2
|
+
|
|
3
|
+
export const COMPANY_NODE_MOCK: CompanyNode = {
|
|
4
|
+
id: 'c1',
|
|
5
|
+
name: '',
|
|
6
|
+
domainName: { primaryLinkUrl: 'acme.com' },
|
|
7
|
+
linkedinLink: null,
|
|
8
|
+
address: null,
|
|
9
|
+
pdlId: null,
|
|
10
|
+
pdlLastEnrichedAt: null,
|
|
11
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type CoreApiClient } from 'twenty-client-sdk/core';
|
|
2
|
+
import { vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
type Resolver<TResult> = TResult | ((request: unknown) => TResult);
|
|
5
|
+
|
|
6
|
+
type CoreApiClientMockOptions = {
|
|
7
|
+
queryResult?: Resolver<unknown>;
|
|
8
|
+
mutationResult?: Resolver<unknown>;
|
|
9
|
+
onMutation?: (request: unknown) => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const resolve = <TResult>(
|
|
13
|
+
resolver: Resolver<TResult> | undefined,
|
|
14
|
+
request: unknown,
|
|
15
|
+
): TResult | undefined =>
|
|
16
|
+
typeof resolver === 'function'
|
|
17
|
+
? (resolver as (request: unknown) => TResult)(request)
|
|
18
|
+
: resolver;
|
|
19
|
+
|
|
20
|
+
export const createCoreApiClientMock = ({
|
|
21
|
+
queryResult,
|
|
22
|
+
mutationResult,
|
|
23
|
+
onMutation,
|
|
24
|
+
}: CoreApiClientMockOptions = {}): CoreApiClient => {
|
|
25
|
+
const query = vi.fn((request: unknown) =>
|
|
26
|
+
Promise.resolve(resolve(queryResult, request)),
|
|
27
|
+
);
|
|
28
|
+
const mutation = vi.fn((request: unknown) => {
|
|
29
|
+
onMutation?.(request);
|
|
30
|
+
|
|
31
|
+
return Promise.resolve(resolve(mutationResult, request) ?? {});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return { query, mutation } as unknown as CoreApiClient;
|
|
35
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type PdlCompanyData } from 'src/types/pdl-company-data';
|
|
2
|
+
|
|
3
|
+
export const PDL_COMPANY_DATA_MOCK: PdlCompanyData = {
|
|
4
|
+
id: 'pdl-company-1',
|
|
5
|
+
display_name: 'Acme Corp',
|
|
6
|
+
website: 'acme.com',
|
|
7
|
+
linkedin_url: 'https://linkedin.com/company/acme',
|
|
8
|
+
industry: 'accounting',
|
|
9
|
+
type: 'private',
|
|
10
|
+
size: '51-200',
|
|
11
|
+
employee_count: 120,
|
|
12
|
+
founded: 2001,
|
|
13
|
+
total_funding_raised: 1234.5,
|
|
14
|
+
latest_funding_stage: 'series_a',
|
|
15
|
+
funding_stages: ['seed', 'series_a', 'not-a-stage'],
|
|
16
|
+
last_funding_date: '2020-05',
|
|
17
|
+
number_funding_rounds: 3,
|
|
18
|
+
tags: ['saas', 'b2b'],
|
|
19
|
+
naics: [{ naics_code: '541511' }],
|
|
20
|
+
location: {
|
|
21
|
+
locality: 'San Francisco',
|
|
22
|
+
region: 'California',
|
|
23
|
+
postal_code: '94107',
|
|
24
|
+
country: 'United States',
|
|
25
|
+
continent: 'north america',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type PdlPersonData } from 'src/types/pdl-person-data';
|
|
2
|
+
|
|
3
|
+
export const PDL_PERSON_DATA_MOCK: PdlPersonData = {
|
|
4
|
+
id: 'pdl-person-1',
|
|
5
|
+
first_name: 'Jane',
|
|
6
|
+
last_name: 'Doe',
|
|
7
|
+
work_email: 'jane.doe@acme.com',
|
|
8
|
+
personal_emails: ['jane@personal.com'],
|
|
9
|
+
job_title: 'Chief Executive Officer',
|
|
10
|
+
linkedin_url: 'https://linkedin.com/in/janedoe',
|
|
11
|
+
industry: 'accounting',
|
|
12
|
+
job_title_role: 'engineering',
|
|
13
|
+
job_title_levels: ['cxo', 'not-a-level'],
|
|
14
|
+
inferred_salary: '45,000-55,000',
|
|
15
|
+
job_company_size: '11-50',
|
|
16
|
+
skills: ['leadership', 'strategy', 'leadership'],
|
|
17
|
+
experience: [{ company: { name: 'Acme' } }],
|
|
18
|
+
birth_date: '1990',
|
|
19
|
+
location_locality: 'San Francisco',
|
|
20
|
+
location_region: 'California',
|
|
21
|
+
location_postal_code: '94107',
|
|
22
|
+
location_country: 'United States',
|
|
23
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PersonNode } from 'src/types/person-node';
|
|
2
|
+
|
|
3
|
+
export const PERSON_NODE_MOCK: PersonNode = {
|
|
4
|
+
id: 'p1',
|
|
5
|
+
name: { firstName: '', lastName: '' },
|
|
6
|
+
emails: null,
|
|
7
|
+
phones: null,
|
|
8
|
+
jobTitle: '',
|
|
9
|
+
linkedinLink: { primaryLinkUrl: 'https://linkedin.com/in/existing' },
|
|
10
|
+
pdlId: null,
|
|
11
|
+
pdlLastEnrichedAt: null,
|
|
12
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { defineLogicFunction } from 'twenty-sdk/define';
|
|
2
|
+
|
|
3
|
+
import { UPDATE_FIELDS_OPTION_VALUES } from 'src/constants/update-fields-option-values';
|
|
4
|
+
import { PDL_LOGIC_FUNCTION_CONSTANTS } from 'src/constants/universal-identifiers';
|
|
5
|
+
import { enrichCompaniesCore } from 'src/logic-functions/handlers/enrich-companies';
|
|
6
|
+
import { type EnrichInput, toBulkEnrichInput } from 'src/logic-functions/utils/to-bulk-enrich-input';
|
|
7
|
+
|
|
8
|
+
const handler = (input: EnrichInput) => {
|
|
9
|
+
return enrichCompaniesCore({ input: toBulkEnrichInput(input) });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default defineLogicFunction({
|
|
13
|
+
universalIdentifier: PDL_LOGIC_FUNCTION_CONSTANTS.enrichCompanies.universalIdentifier,
|
|
14
|
+
name: 'enrich-companies',
|
|
15
|
+
description: 'Enrich one or more Company records with People Data Labs data',
|
|
16
|
+
timeoutSeconds: 300,
|
|
17
|
+
handler,
|
|
18
|
+
httpRouteTriggerSettings: {
|
|
19
|
+
path: PDL_LOGIC_FUNCTION_CONSTANTS.enrichCompanies.path,
|
|
20
|
+
httpMethod: 'POST',
|
|
21
|
+
isAuthRequired: true
|
|
22
|
+
},
|
|
23
|
+
workflowActionTriggerSettings: {
|
|
24
|
+
label: 'Enrich Companies',
|
|
25
|
+
icon: 'IconSparkles',
|
|
26
|
+
inputSchema: [
|
|
27
|
+
{
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
records: {
|
|
31
|
+
type: 'array',
|
|
32
|
+
items: { type: 'object' },
|
|
33
|
+
label: 'Records',
|
|
34
|
+
},
|
|
35
|
+
updateFields: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
label: 'Update fields',
|
|
38
|
+
enum: [...UPDATE_FIELDS_OPTION_VALUES],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
outputSchema: [
|
|
44
|
+
{
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: {
|
|
47
|
+
success: { type: 'boolean', label: 'Success' },
|
|
48
|
+
total: { type: 'number', label: 'Total' },
|
|
49
|
+
matched: { type: 'number', label: 'Matched' },
|
|
50
|
+
notFound: { type: 'number', label: 'Not Found' },
|
|
51
|
+
skipped: { type: 'number', label: 'Skipped' },
|
|
52
|
+
errored: { type: 'number', label: 'Errored' },
|
|
53
|
+
results: {
|
|
54
|
+
type: 'array',
|
|
55
|
+
items: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: {
|
|
58
|
+
success: { type: 'boolean', label: 'Success' },
|
|
59
|
+
recordId: { type: 'string', label: 'Record Id' },
|
|
60
|
+
status: { type: 'string', label: 'Status' },
|
|
61
|
+
updatedFields: {
|
|
62
|
+
type: 'array',
|
|
63
|
+
items: { type: 'string' },
|
|
64
|
+
label: 'Updated Fields',
|
|
65
|
+
},
|
|
66
|
+
data: { type: 'object', label: 'Data' },
|
|
67
|
+
message: { type: 'string', label: 'Message' },
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
label: 'Results',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { defineLogicFunction } from 'twenty-sdk/define';
|
|
2
|
+
|
|
3
|
+
import { UPDATE_FIELDS_OPTION_VALUES } from 'src/constants/update-fields-option-values';
|
|
4
|
+
import { PDL_LOGIC_FUNCTION_CONSTANTS } from 'src/constants/universal-identifiers';
|
|
5
|
+
import { enrichCompanyCore } from 'src/logic-functions/handlers/enrich-company';
|
|
6
|
+
import { type SingleEnrichInput } from 'src/types/single-enrich-input';
|
|
7
|
+
|
|
8
|
+
const handler = (input: SingleEnrichInput) => enrichCompanyCore({ input });
|
|
9
|
+
|
|
10
|
+
export default defineLogicFunction({
|
|
11
|
+
universalIdentifier: PDL_LOGIC_FUNCTION_CONSTANTS.enrichCompany.universalIdentifier,
|
|
12
|
+
name: 'enrich-company',
|
|
13
|
+
description:
|
|
14
|
+
'Enrich a single Company record with People Data Labs data (industry, size, funding, location, etc.) given its record id.',
|
|
15
|
+
timeoutSeconds: 60,
|
|
16
|
+
handler,
|
|
17
|
+
workflowActionTriggerSettings: {
|
|
18
|
+
label: 'Enrich Company',
|
|
19
|
+
icon: 'IconSparkles',
|
|
20
|
+
inputSchema: [
|
|
21
|
+
{
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
recordId: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
label: 'Record',
|
|
27
|
+
},
|
|
28
|
+
updateFields: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
label: 'Update fields',
|
|
31
|
+
enum: [...UPDATE_FIELDS_OPTION_VALUES],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
outputSchema: [
|
|
37
|
+
{
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
success: { type: 'boolean', label: 'Success' },
|
|
41
|
+
recordId: { type: 'string', label: 'Record Id' },
|
|
42
|
+
status: { type: 'string', label: 'Status' },
|
|
43
|
+
updatedFields: {
|
|
44
|
+
type: 'array',
|
|
45
|
+
items: { type: 'string' },
|
|
46
|
+
label: 'Updated Fields',
|
|
47
|
+
},
|
|
48
|
+
data: { type: 'object', label: 'Data' },
|
|
49
|
+
message: { type: 'string', label: 'Message' },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
toolTriggerSettings: {
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: {
|
|
58
|
+
recordId: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'The id of the Company record to enrich.',
|
|
61
|
+
},
|
|
62
|
+
updateFields: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
enum: [...UPDATE_FIELDS_OPTION_VALUES],
|
|
65
|
+
description:
|
|
66
|
+
'Whether to write the enriched data back to the record. "Yes and overwrite" replaces existing values; "Yes and don\'t overwrite" only fills empty fields; "No" returns the enriched data without modifying the record.',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
required: ['recordId'],
|
|
70
|
+
additionalProperties: false,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { defineLogicFunction } from 'twenty-sdk/define';
|
|
2
|
+
|
|
3
|
+
import { UPDATE_FIELDS_OPTION_VALUES } from 'src/constants/update-fields-option-values';
|
|
4
|
+
import { PDL_LOGIC_FUNCTION_CONSTANTS } from 'src/constants/universal-identifiers';
|
|
5
|
+
import { enrichPeopleCore } from 'src/logic-functions/handlers/enrich-people';
|
|
6
|
+
import { type EnrichInput, toBulkEnrichInput } from 'src/logic-functions/utils/to-bulk-enrich-input';
|
|
7
|
+
|
|
8
|
+
const handler = (input: EnrichInput) => {
|
|
9
|
+
return enrichPeopleCore({ input: toBulkEnrichInput(input) });
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default defineLogicFunction({
|
|
13
|
+
universalIdentifier: PDL_LOGIC_FUNCTION_CONSTANTS.enrichPeople.universalIdentifier,
|
|
14
|
+
name: 'enrich-people',
|
|
15
|
+
description: 'Enrich one or more Person records with People Data Labs data',
|
|
16
|
+
timeoutSeconds: 300,
|
|
17
|
+
handler,
|
|
18
|
+
httpRouteTriggerSettings: {
|
|
19
|
+
path: PDL_LOGIC_FUNCTION_CONSTANTS.enrichPeople.path,
|
|
20
|
+
httpMethod: 'POST',
|
|
21
|
+
isAuthRequired: true
|
|
22
|
+
},
|
|
23
|
+
workflowActionTriggerSettings: {
|
|
24
|
+
label: 'Enrich People',
|
|
25
|
+
icon: 'IconSparkles',
|
|
26
|
+
inputSchema: [
|
|
27
|
+
{
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
records: {
|
|
31
|
+
type: 'array',
|
|
32
|
+
items: { type: 'object' },
|
|
33
|
+
label: 'Records',
|
|
34
|
+
},
|
|
35
|
+
updateFields: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
label: 'Update fields',
|
|
38
|
+
enum: [...UPDATE_FIELDS_OPTION_VALUES],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
outputSchema: [
|
|
44
|
+
{
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: {
|
|
47
|
+
success: { type: 'boolean', label: 'Success' },
|
|
48
|
+
total: { type: 'number', label: 'Total' },
|
|
49
|
+
matched: { type: 'number', label: 'Matched' },
|
|
50
|
+
notFound: { type: 'number', label: 'Not Found' },
|
|
51
|
+
skipped: { type: 'number', label: 'Skipped' },
|
|
52
|
+
errored: { type: 'number', label: 'Errored' },
|
|
53
|
+
results: {
|
|
54
|
+
type: 'array',
|
|
55
|
+
items: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: {
|
|
58
|
+
success: { type: 'boolean', label: 'Success' },
|
|
59
|
+
recordId: { type: 'string', label: 'Record Id' },
|
|
60
|
+
status: { type: 'string', label: 'Status' },
|
|
61
|
+
updatedFields: {
|
|
62
|
+
type: 'array',
|
|
63
|
+
items: { type: 'string' },
|
|
64
|
+
label: 'Updated Fields',
|
|
65
|
+
},
|
|
66
|
+
data: { type: 'object', label: 'Data' },
|
|
67
|
+
message: { type: 'string', label: 'Message' },
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
label: 'Results',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
});
|