Coder Social home page Coder Social logo

peopledatalabs / peopledatalabs-js Goto Github PK

View Code? Open in Web Editor NEW
19.0 4.0 7.0 1.36 MB

A universal JS client with TypeScript support for the People Data Labs API

Home Page: https://docs.peopledatalabs.com/docs/javascript-sdk

License: MIT License

JavaScript 28.44% TypeScript 71.56%
api enrichment people companies search peopledatalabs people-data company-data contact-data data-enrichment

peopledatalabs-js's People

Contributors

benasher44 avatar dantonioroda avatar davidchouinard avatar dependabot[bot] avatar dionlarson avatar vrajur-pdl avatar vvillait88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

peopledatalabs-js's Issues

Incorrect import/export paths for TypeScript + ESM + NodeNext

Describe the bug
With TypeScript + moduleResolution:NodeNext, you get import errors like this:

node_modules/peopledatalabs/dist/index.d.ts:2:58 - error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.

import { AutoCompleteParams, AutoCompleteResponse } from './types/autocomplete-types';

To Reproduce
Steps to reproduce the behavior:

Import anything from peopledatalabs in a TypeScript project using moduleResolution: NodeNext

Expected behavior
Imports without error

Screenshots
If applicable, add screenshots to help explain your problem.

  • peopledatalabs Library Version: 6.0.0
  • Node Version: 20.10.0
  • NPM Version: 10.2.3

Additional context

Using https://arethetypeswrong.github.io/?p=peopledatalabs%406.2.0 as a guide, you can get a sense of issues that need to be fixed for proper TypeScript + ESM + NodeNext support. The resolution errors called out are likely due to the missing .js extensions. Once you fix those, it's then just about getting the package.json correct. See bpmn-io/min-dash#29 for a similar fix (had a similar set of issues + similar initial package.json layout).

Type definitions are not been exported

Describe the bug
When trying to use the SDK with TypeScript, I expect that types of response will be inferred, but this not actually happens, nor the inner types (like PersonEnrichmentResponse for example) can't be imported because they are not exported from index.d.ts

To Reproduce
Try to use a type from the library that is not directly under the PDLJS class declaration.

Expected behavior
I can import types and types are inferred in the correct way.

Screenshots
1: this is the right type:
image
2: but it doesn't go to the internal type:
image
3: nor it can be imported:
image

  • peopledatalabs Library Version: 4.0.3
  • Node Version: 19.3.0
  • NPM Version

Additional context
Add any other context about the problem here.

titlecase in bulk retrieve people function

Is your feature request related to a problem? Please describe.
It doesn't look like we can pass titlecase: true when using the bulk person retrieve function. It looks like the api supports this could it be added as a param?

Describe the solution you'd like
Have titlecase as a param we can use in the bulk person retrieve function.

Describe alternatives you've considered
If theres a good work around we're open.

Additional context
We are using search preview in our front end and then use bulk retrieve calls with the pdl ids from the initial search. We have titlecase: true on the search params then end up returning lowercase everything with the retrieve function. We're enterprise customers as well.

Issue with 3.1.3

Describe the bug
Upgrading to 3.1.3, from 3.1.2 breaks the app.
The error surfaces at runtime, and I'm unsure on whether it's coming from the server-side (next.js pages/api) or the module, or some mismatch of module format compatibility. I can only see on the console the following message, without traces:
error - ReferenceError: self is not defined

To Reproduce
Not easy, the module is used in a complex Next.js application. It's imported as follows:

  import PDLJS from 'peopledatalabs';
  ...
  private PDLJSClient = new PDLJS({ 'apiKey': ... });

Expected behavior
The application shall run; instead a red error message about missing 'self' shows up.

Screenshots
Update: attached code that causes the 'self'.. issue.

  • peopledatalabs 3.1.3
  • Node Version 16.13.2
  • NPM Version 7.11.2

Additional context
Update:
Seems to be something related to migrating from CJS modules (3.1.2) to UMD (3.1.3).
In particular the following line in main.umd.js seems to cause the problem:
(e || self).peopledatalabs

image

image

Can't operate the library in a TS project

Hi
Im using "typescript": "4.5.2" with "peopledatalabs": "^3.1.8", I cant really build my code because of the following error:

------                                                                                                                                                                                                                                                                                                                        
 > [build 21/21] RUN node ./node_modules/@nestjs/cli/bin/nest build people-data-labs:                                                                                                                                                                                                                                         
#29 14.98 apps/people-data-labs/src/people-data-labs.service.ts:17:24 - error TS2307: Cannot find module 'peopledatalabs' or its corresponding type declarations.                                                                                                                                                             
#29 14.98                                                                                                                                                                                                                                                                                                                     
#29 14.98 17 import * as PDLJS from 'peopledatalabs';                                                                                                                                                                                                                                                                         
#29 14.98                           ~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                          
#29 14.98 apps/people-data-labs/src/people-data-labs.service.ts:18:38 - error TS2307: Cannot find module 'peopledatalabs/src/types/search-types' or its corresponding type declarations.
#29 14.98 
#29 14.98 18 import { PersonSearchResponse } from 'peopledatalabs/src/types/search-types';
#29 14.98                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#29 14.98 apps/people-data-labs/src/people-data-labs.service.ts:19:32 - error TS2307: Cannot find module 'peopledatalabs/src/types/common-types' or its corresponding type declarations.
#29 14.98 
#29 14.98 19 import { PersonResponse } from 'peopledatalabs/src/types/common-types';
#29 14.98                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#29 14.98 
#29 14.98 Found 3 error(s).
#29 14.98 
------

import { PDLJS } from 'peopledatalabs'; has the same error.
import { PersonSearchResponse } from 'peopledatalabs' has the same error.

Thanks

PersonResponse type doesn't seem to match PDL API response

Describe the bug
There are a couple of properties on the PersonResponse type (and sub-types) defined as strings that the API seems to return as different types. Specifically job_company_founded (is a Number from the API data I've seen), PersonExperienceResponse company.founded should also be a number, and is_primary should be a boolean value.

To Reproduce
Steps to reproduce the behavior:
curl "https://api.peopledatalabs.com/v5/person/enrich?api_key=${API_KEY}&pretty=True&profile=linkedin.com/in/seanthorne"
Then take the data part of the output and declare a var in TypeScript:

export const fullPdlResponse: PersonResponse = {
...
}

Notice the type errors for the properties above.

Expected behavior
The output from the API should match the type definition.

Screenshots
If applicable, add screenshots to help explain your problem.
Screen Shot 2022-08-17 at 10 40 46 AM

  • peopledatalabs Library Version 4.0.2
  • Node Version 16.15.0
  • NPM Version 8.5.5

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.