peopledatalabs
Advanced tools
Comparing version 6.2.0 to 7.0.0
@@ -1,4 +0,4 @@ | ||
import type { AutoCompleteParams, AutoCompleteResponse } from '../../types/autocomplete-types'; | ||
import type { AutoCompleteParams, AutoCompleteResponse } from '../../types/autocomplete-types.js'; | ||
declare const _default: (basePath: string, apiKey: string, params: AutoCompleteParams) => Promise<AutoCompleteResponse>; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { BulkPersonEnrichmentParams, BulkPersonEnrichmentResponse } from '../../types/bulk-types'; | ||
import { BulkPersonEnrichmentParams, BulkPersonEnrichmentResponse } from '../../types/bulk-types.js'; | ||
declare const _default: (basePath: string, apiKey: string, records: BulkPersonEnrichmentParams) => Promise<BulkPersonEnrichmentResponse>; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { BulkPersonRetrieveParams, BulkPersonRetrieveResponse } from '../../types/bulk-retrieve-types'; | ||
import { BulkPersonRetrieveParams, BulkPersonRetrieveResponse } from '../../types/bulk-retrieve-types.js'; | ||
declare const _default: (basePath: string, apiKey: string, records: BulkPersonRetrieveParams) => Promise<BulkPersonRetrieveResponse>; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,5 +0,5 @@ | ||
import { BaseResponse } from '../../types/api-types'; | ||
import { CleanerType } from '../../types/cleaner-types'; | ||
import { BaseResponse } from '../../types/api-types.js'; | ||
import { CleanerType } from '../../types/cleaner-types.js'; | ||
declare const _default: <T, K extends BaseResponse>(basePath: string, apiKey: string, params: T, type: CleanerType) => Promise<K>; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { CompanyEnrichmentParams, CompanyEnrichmentResponse, EnrichmentType, PersonEnrichmentParams, PersonEnrichmentResponse } from '../../types/enrichment-types'; | ||
import { CompanyEnrichmentParams, CompanyEnrichmentResponse, EnrichmentType, PersonEnrichmentParams, PersonEnrichmentResponse } from '../../types/enrichment-types.js'; | ||
declare const _default: <T extends PersonEnrichmentParams | CompanyEnrichmentParams, K extends PersonEnrichmentResponse | CompanyEnrichmentResponse>(basePath: string, sandboxBasePath: string, apiKey: string, params: T, type: EnrichmentType) => Promise<K>; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { PersonEnrichmentPreviewParams, PersonEnrichmentPreviewResponse } from '../../types/enrichment-types'; | ||
import { PersonEnrichmentPreviewParams, PersonEnrichmentPreviewResponse } from '../../types/enrichment-types.js'; | ||
declare const _default: (basePath: string, sandboxBasePath: string, apiKey: string, params: PersonEnrichmentPreviewParams) => Promise<PersonEnrichmentPreviewResponse>; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { IdentifyParams, IdentifyResponse } from '../../types/identify-types'; | ||
import { IdentifyParams, IdentifyResponse } from '../../types/identify-types.js'; | ||
declare const _default: (basePath: string, sandboxBasePath: string, apiKey: string, params: IdentifyParams) => Promise<IdentifyResponse>; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,13 +0,14 @@ | ||
import autocomplete from './autocomplete'; | ||
import bulkEnrichment from './bulkEnrichment'; | ||
import bulkRetrieve from './bulkRetrieve'; | ||
import cleaner from './cleaner'; | ||
import enrichment from './enrichment'; | ||
import enrichmentPreview from './enrichmentPreview'; | ||
import identify from './identify'; | ||
import jobTitle from './jobTitle'; | ||
import retrieve from './retrieve'; | ||
import search from './search'; | ||
import skill from './skill'; | ||
export { autocomplete, bulkEnrichment, bulkRetrieve, cleaner, enrichment, enrichmentPreview, identify, jobTitle, retrieve, search, skill }; | ||
import autocomplete from './autocomplete/index.js'; | ||
import bulkCompanyEnrichment from './bulkCompanyEnrichment/index.js'; | ||
import bulkEnrichment from './bulkEnrichment/index.js'; | ||
import bulkRetrieve from './bulkRetrieve/index.js'; | ||
import cleaner from './cleaner/index.js'; | ||
import enrichment from './enrichment/index.js'; | ||
import enrichmentPreview from './enrichmentPreview/index.js'; | ||
import identify from './identify/index.js'; | ||
import jobTitle from './jobTitle/index.js'; | ||
import retrieve from './retrieve/index.js'; | ||
import search from './search/index.js'; | ||
import skill from './skill/index.js'; | ||
export { autocomplete, bulkCompanyEnrichment, bulkEnrichment, bulkRetrieve, cleaner, enrichment, enrichmentPreview, identify, jobTitle, retrieve, search, skill }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { IPParams, IPResponse } from '../../types/ip-types'; | ||
import { IPParams, IPResponse } from '../../types/ip-types.js'; | ||
declare const _default: (basePath: string, apiKey: string, params: IPParams) => Promise<IPResponse>; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { JobTitleParams, JobTitleResponse } from '../../types/jobTitle-types'; | ||
import { JobTitleParams, JobTitleResponse } from '../../types/jobTitle-types.js'; | ||
declare const _default: (basePath: string, apiKey: string, params: JobTitleParams) => Promise<JobTitleResponse>; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RetrieveParams, RetrieveResponse } from '../../types/retrieve-types'; | ||
import { RetrieveParams, RetrieveResponse } from '../../types/retrieve-types.js'; | ||
declare const _default: (basePath: string, apiKey: string, params: RetrieveParams) => Promise<RetrieveResponse>; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,5 +0,5 @@ | ||
import { BaseResponse } from '../../types/api-types'; | ||
import { BaseSearchParams, SearchType } from '../../types/search-types'; | ||
import { BaseResponse } from '../../types/api-types.js'; | ||
import { BaseSearchParams, SearchType } from '../../types/search-types.js'; | ||
declare const _default: <T extends BaseSearchParams, K extends BaseResponse>(basePath: string, sandboxBasePath: string, apiKey: string, searchType: SearchType, params: T, type: string) => Promise<K>; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { SkillParams, SkillResponse } from '../../types/skill-types'; | ||
import { SkillParams, SkillResponse } from '../../types/skill-types.js'; | ||
declare const _default: (basePath: string, apiKey: string, params: SkillParams) => Promise<SkillResponse>; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
import { AxiosError } from 'axios'; | ||
import { ErrorEndpoint, PdlError } from './types/error-types'; | ||
import { ErrorEndpoint, PdlError } from './types/error-types.js'; | ||
declare const check: (params: unknown, basePath: string, apiKey: string, type: string | null, endpoint: ErrorEndpoint) => Promise<void>; | ||
@@ -4,0 +4,0 @@ declare const errorHandler: (error: AxiosError) => PdlError; |
@@ -1,14 +0,14 @@ | ||
import { APISettings } from './types/api-types'; | ||
import { AutoCompleteParams, AutoCompleteResponse } from './types/autocomplete-types'; | ||
import { BulkPersonRetrieveParams, BulkPersonRetrieveResponse } from './types/bulk-retrieve-types'; | ||
import { BulkPersonEnrichmentParams, BulkPersonEnrichmentResponse } from './types/bulk-types'; | ||
import { CompanyCleanerParams, CompanyCleanerResponse, LocationCleanerParams, LocationCleanerResponse, SchoolCleanerParams, SchoolCleanerResponse } from './types/cleaner-types'; | ||
import { CompanyResponse, PersonResponse } from './types/common-types'; | ||
import { CompanyEnrichmentParams, CompanyEnrichmentResponse, PersonEnrichmentParams, PersonEnrichmentPreviewParams, PersonEnrichmentPreviewResponse, PersonEnrichmentResponse, PersonPreviewResponse } from './types/enrichment-types'; | ||
import { IdentifyParams, IdentifyResponse } from './types/identify-types'; | ||
import { IPParams, IPResponse } from './types/ip-types'; | ||
import { JobTitleParams, JobTitleResponse } from './types/jobTitle-types'; | ||
import { RetrieveParams, RetrieveResponse } from './types/retrieve-types'; | ||
import { CompanySearchParams, CompanySearchResponse, PersonSearchParams, PersonSearchResponse } from './types/search-types'; | ||
import { SkillParams, SkillResponse } from './types/skill-types'; | ||
import { APISettings } from './types/api-types.js'; | ||
import { AutoCompleteParams, AutoCompleteResponse } from './types/autocomplete-types.js'; | ||
import { BulkPersonRetrieveParams, BulkPersonRetrieveResponse } from './types/bulk-retrieve-types.js'; | ||
import { BulkCompanyEnrichmentParams, BulkCompanyEnrichmentResponse, BulkPersonEnrichmentParams, BulkPersonEnrichmentResponse } from './types/bulk-types.js'; | ||
import { CompanyCleanerParams, CompanyCleanerResponse, LocationCleanerParams, LocationCleanerResponse, SchoolCleanerParams, SchoolCleanerResponse } from './types/cleaner-types.js'; | ||
import { CompanyResponse, PersonResponse } from './types/common-types.js'; | ||
import { CompanyEnrichmentParams, CompanyEnrichmentResponse, PersonEnrichmentParams, PersonEnrichmentPreviewParams, PersonEnrichmentPreviewResponse, PersonEnrichmentResponse, PersonPreviewResponse } from './types/enrichment-types.js'; | ||
import { IdentifyParams, IdentifyResponse } from './types/identify-types.js'; | ||
import { IPParams, IPResponse } from './types/ip-types.js'; | ||
import { JobTitleParams, JobTitleResponse } from './types/jobTitle-types.js'; | ||
import { RetrieveParams, RetrieveResponse } from './types/retrieve-types.js'; | ||
import { CompanySearchParams, CompanySearchResponse, PersonSearchParams, PersonSearchResponse } from './types/search-types.js'; | ||
import { SkillParams, SkillResponse } from './types/skill-types.js'; | ||
declare class PDLJS { | ||
@@ -39,2 +39,5 @@ private readonly apiKey; | ||
cleaner: (params: CompanyCleanerParams) => Promise<CompanyCleanerResponse>; | ||
bulk: { | ||
enrichment: (records: BulkCompanyEnrichmentParams) => Promise<BulkCompanyEnrichmentResponse>; | ||
}; | ||
}; | ||
@@ -54,3 +57,3 @@ school: { | ||
export default PDLJS; | ||
export type { APISettings, AutoCompleteParams, AutoCompleteResponse, BulkPersonEnrichmentParams, BulkPersonEnrichmentResponse, BulkPersonRetrieveParams, BulkPersonRetrieveResponse, CompanyCleanerParams, CompanyCleanerResponse, CompanyEnrichmentParams, CompanyEnrichmentResponse, CompanyResponse, CompanySearchParams, CompanySearchResponse, IdentifyParams, IdentifyResponse, IPParams, IPResponse, JobTitleParams, JobTitleResponse, LocationCleanerParams, LocationCleanerResponse, PersonEnrichmentParams, PersonEnrichmentPreviewParams, PersonEnrichmentPreviewResponse, PersonEnrichmentResponse, PersonPreviewResponse, PersonResponse, PersonSearchParams, PersonSearchResponse, RetrieveParams, RetrieveResponse, SchoolCleanerParams, SchoolCleanerResponse, SkillParams, SkillResponse, }; | ||
export type { APISettings, AutoCompleteParams, AutoCompleteResponse, BulkCompanyEnrichmentParams, BulkCompanyEnrichmentResponse, BulkPersonEnrichmentParams, BulkPersonEnrichmentResponse, BulkPersonRetrieveParams, BulkPersonRetrieveResponse, CompanyCleanerParams, CompanyCleanerResponse, CompanyEnrichmentParams, CompanyEnrichmentResponse, CompanyResponse, CompanySearchParams, CompanySearchResponse, IdentifyParams, IdentifyResponse, IPParams, IPResponse, JobTitleParams, JobTitleResponse, LocationCleanerParams, LocationCleanerResponse, PersonEnrichmentParams, PersonEnrichmentPreviewParams, PersonEnrichmentPreviewResponse, PersonEnrichmentResponse, PersonPreviewResponse, PersonResponse, PersonSearchParams, PersonSearchResponse, RetrieveParams, RetrieveResponse, SchoolCleanerParams, SchoolCleanerResponse, SkillParams, SkillResponse, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import e from"axios";import{copy as t}from"copy-anything";function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},n.apply(this,arguments)}var i=function(e){var t={rateLimitRemaining:e.headers["x-ratelimit-remaining"]?JSON.parse(e.headers["x-ratelimit-remaining"].replace(/'/g,'"')):void 0,rateLimitReset:e.headers["x-ratelimit-reset"]||void 0,rateLimitLimit:e.headers["x-ratelimit-limit"]?JSON.parse(e.headers["x-ratelimit-limit"].replace(/'/g,'"')):void 0,totalLimitOveragesRemaining:e.headers["x-totallimit-overages-remaining"]?Number(e.headers["x-totallimit-overages-remaining"]):void 0,totalLimitPurchasedRemaining:e.headers["x-totallimit-purchased-remaining"]?Number(e.headers["x-totallimit-purchased-remaining"]):void 0,totalLimitRemaining:e.headers["x-totallimit-remaining"]?Number(e.headers["x-totallimit-remaining"]):void 0,callCreditsType:e.headers["x-call-credits-type"]||void 0,callCreditsSpent:e.headers["x-call-credits-spent"]?Number(e.headers["x-call-credits-spent"]):void 0,lifetimeUsed:e.headers["x-lifetime-used"]?Number(e.headers["x-lifetime-used"]):void 0};return Array.isArray(e.data)?{items:e.data,rateLimit:t}:n({},e.data,{rateLimit:t})},a=function(e,t,n,i,a){return new Promise(function(r,s){var o={};if(e||(o.message="Missing "+(i||"Params"),o.status=400,s(o)),"search"===a&&(e.searchQuery||(o.message="Missing searchQuery",o.status=400,s(o))),"retrieve"===a&&(e.id||(o.message="Missing id",o.status=400,s(o))),"autocomplete"===a){var c=e.field,u=["company","country","industry","location","major","region","role","school","sub_role","skill","title"];c?-1===u.indexOf(c)&&(o.message="field should be one of: "+u,o.status=400,s(o)):(o.message="Missing field",o.status=400,s(o))}"jobTitle"===a&&(e.jobTitle||(o.message="Missing jobTitle",o.status=400,s(o))),"skill"===a&&(e.skill||(o.message="Missing skill",o.status=400,s(o))),"ip"===a&&(e.ip||(o.message="Missing ip",o.status=400,s(o))),t||(o.message="Missing API Base Path",o.status=400,s(o)),n&&64===n.length||(o.message="Invalid API Key",o.status=401,s(o)),r()})},r=function(e){var t={400:"Request contained either missing or invalid parameters",401:"Request contained a missing or invalid key",402:"Payment Required, You have hit your account maximum (all matches used)",404:"No records were found matching your request",405:"Request method is not allowed on the requested resource",429:"An error occurred due to requests hitting the API too quick",500:"The server encountered an unexpected condition which prevented it from fulfilling the request"};if(e.response){var n=e.response.status,a=n>=500&&n<600?500:n,r=i(e.response);return{status:a,message:t[a],rateLimit:r.rateLimit}}return{status:500,message:t[500]}},s=function(t,s,o,c){return new Promise(function(u,l){a(o,t,s,null,"cleaner").then(function(){e.get(t+"/"+c+"/clean",{params:n({api_key:s},o),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&u(i(e))}).catch(function(e){l(r(e))})}).catch(function(e){l(e)})})},o=function(n,s,o,c,u){return new Promise(function(l,p){a(c,n,o,null,"enrichment").then(function(){var a=c.sandbox&&"person"===u?s+"/"+u+"/enrich":n+"/"+u+"/enrich",h=t(c),d=new URLSearchParams;delete h.sandbox,Object.entries(h).forEach(function(e){var t=e[0],n=e[1];"profile"===t?Array.isArray(n)?d.append(t,JSON.stringify(n)):d.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){d.append(t,e)}):d.append(t,JSON.stringify(n)):d.append(t,n)}),d.append("api_key",o),e.get(a,{params:d,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&l(i(e))}).catch(function(e){p(r(e))})}).catch(function(e){p(e)})})},c=function(t,n,s,o,c,u){return new Promise(function(l,p){a(c,t,s,null,"search").then(function(){var a,h=c.pretty,d=c.sandbox,f=((a={titlecase:c.titlecase||!1,dataset:c.dataset||"all",scroll_token:c.scroll_token||null,size:c.size||10})["sql"===o?"sql":"query"]=c.searchQuery,a.pretty=h||!1,a);e.post(d&&"person"===u?n+"/person/search":t+"/"+u+"/search",f,{headers:{"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":s,"User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&l(i(e))}).catch(function(e){p(r(e))})}).catch(function(e){p(e)})})},u=function(u){var l=this,p=u.apiKey,h=u.basePath,d=u.sandboxBasePath,f=u.version;this.apiKey=void 0,this.basePath=void 0,this.sandboxBasePath=void 0,this.person=void 0,this.company=void 0,this.school=void 0,this.location=void 0,this.autocomplete=void 0,this.skill=void 0,this.jobTitle=void 0,this.ip=void 0,this.apiKey=p,this.basePath=h||"https://api.peopledatalabs.com/"+(f||"v5"),this.sandboxBasePath=d||"https://sandbox.api.peopledatalabs.com/"+(f||"v5"),this.person={enrichment:function(e){return o(l.basePath,l.sandboxBasePath,l.apiKey,e,"person")},enrichmentPreview:function(n){return function(n,s,o,c){return new Promise(function(u,l){a(c,n,o,null,"enrichment").then(function(){var a=c.sandbox?s+"/person/enrich/preview":n+"/person/enrich/preview",p=t(c),h=new URLSearchParams;delete p.sandbox,Object.entries(p).forEach(function(e){var t=e[0],n=e[1];"profile"===t?Array.isArray(n)?h.append(t,JSON.stringify(n)):h.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){h.append(t,e)}):h.append(t,JSON.stringify(n)):h.append(t,n)}),h.append("api_key",o),e.get(a,{params:h,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&u(i(e))}).catch(function(e){l(r(e))})}).catch(function(e){l(e)})})}(l.basePath,l.sandboxBasePath,l.apiKey,n)},search:{elastic:function(e){return c(l.basePath,l.sandboxBasePath,l.apiKey,"elastic",e,"person")},sql:function(e){return c(l.basePath,l.sandboxBasePath,l.apiKey,"sql",e,"person")}},bulk:{enrichment:function(t){return function(t,n,s){var o={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":n,"User-Agent":"PDL-JS-SDK"};return new Promise(function(c,u){a(s,t,n,"Records","bulk").then(function(){e.post(t+"/person/bulk",s,{headers:o}).then(function(e){c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)},retrieve:function(t){return function(t,s,o){var c={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":s,"User-Agent":"PDL-JS-SDK"};return new Promise(function(u,l){a(o,t,s,"Records","bulk").then(function(){var a,s,p=n({},a=o,null==(s=a.filter_updated)?{filter_updated:void 0}:{filter_updated:(Array.isArray(s)?s:[s]).join(",")});e.post(t+"/person/retrieve/bulk",p,{headers:c}).then(function(e){u(i(e))}).catch(function(e){l(r(e))})}).catch(function(e){l(e)})})}(l.basePath,l.apiKey,t)}},identify:function(n){return function(n,s,o,c){return new Promise(function(u,l){a(c,n,o,null,"identify").then(function(){var a=c.sandbox?s+"/person/identify":n+"/person/identify",p=t(c),h=new URLSearchParams;delete p.sandbox,Object.entries(p).forEach(function(e){var t=e[0],n=e[1];"profile"===t?Array.isArray(n)?h.append(t,JSON.stringify(n)):h.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){h.append(t,e)}):h.append(t,JSON.stringify(n)):h.append(t,n)}),h.append("api_key",o),e.get(a,{params:h,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&u(i(e))}).catch(function(e){l(r(e))})}).catch(function(e){l(e)})})}(l.basePath,l.sandboxBasePath,l.apiKey,n)},retrieve:function(t){return function(t,s,o){return new Promise(function(c,u){a(o,t,s,"ID","retrieve").then(function(){var a=function(e){var t=e.filter_updated;return n({},e,null==t?{filter_updated:void 0}:{filter_updated:(Array.isArray(t)?t:[t]).join(",")})}(o);e.get(t+"/person/retrieve/"+o.id,{params:n({api_key:s},a),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)}},this.company={enrichment:function(e){return o(l.basePath,l.sandboxBasePath,l.apiKey,e,"company")},search:{elastic:function(e){return c(l.basePath,l.sandboxBasePath,l.apiKey,"elastic",e,"company")},sql:function(e){return c(l.basePath,l.sandboxBasePath,l.apiKey,"sql",e,"company")}},cleaner:function(e){return s(l.basePath,l.apiKey,e,"company")}},this.school={cleaner:function(e){return s(l.basePath,l.apiKey,e,"school")}},this.location={cleaner:function(e){return s(l.basePath,l.apiKey,e,"location")}},this.autocomplete=function(t){return function(t,s,o){return new Promise(function(c,u){a(o,t,s,null,"autocomplete").then(function(){e.get(t+"/autocomplete",{params:n({api_key:s},{field:o.field,text:o.text||"",size:o.size||10,pretty:o.pretty||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)},this.jobTitle=function(t){return function(t,s,o){return new Promise(function(c,u){a(o,t,s,null,"jobTitle").then(function(){e.get(t+"/job_title/enrich",{params:n({api_key:s},{job_title:o.jobTitle,pretty:o.pretty||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)},this.skill=function(t){return function(t,s,o){return new Promise(function(c,u){a(o,t,s,null,"skill").then(function(){e.get(t+"/skill/enrich",{params:n({api_key:s},{skill:o.skill,pretty:o.pretty||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)},this.ip=function(t){return function(t,s,o){return new Promise(function(c,u){a(o,t,s,null,"ip").then(function(){e.get(t+"/ip/enrich",{params:n({api_key:s},o),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)}};export{u as default}; | ||
import e from"axios";import{copy as t}from"copy-anything";function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},n.apply(this,arguments)}var i=function(e){var t={rateLimitRemaining:e.headers["x-ratelimit-remaining"]?JSON.parse(e.headers["x-ratelimit-remaining"].replace(/'/g,'"')):void 0,rateLimitReset:e.headers["x-ratelimit-reset"]||void 0,rateLimitLimit:e.headers["x-ratelimit-limit"]?JSON.parse(e.headers["x-ratelimit-limit"].replace(/'/g,'"')):void 0,totalLimitOveragesRemaining:e.headers["x-totallimit-overages-remaining"]?Number(e.headers["x-totallimit-overages-remaining"]):void 0,totalLimitPurchasedRemaining:e.headers["x-totallimit-purchased-remaining"]?Number(e.headers["x-totallimit-purchased-remaining"]):void 0,totalLimitRemaining:e.headers["x-totallimit-remaining"]?Number(e.headers["x-totallimit-remaining"]):void 0,callCreditsType:e.headers["x-call-credits-type"]||void 0,callCreditsSpent:e.headers["x-call-credits-spent"]?Number(e.headers["x-call-credits-spent"]):void 0,lifetimeUsed:e.headers["x-lifetime-used"]?Number(e.headers["x-lifetime-used"]):void 0};return Array.isArray(e.data)?{items:e.data,rateLimit:t}:n({},e.data,{rateLimit:t})},a=function(e,t,n,i,a){return new Promise(function(r,s){var o={};if(e||(o.message="Missing "+(i||"Params"),o.status=400,s(o)),"search"===a&&(e.searchQuery||(o.message="Missing searchQuery",o.status=400,s(o))),"retrieve"===a&&(e.id||(o.message="Missing id",o.status=400,s(o))),"autocomplete"===a){var c=e.field,u=["company","country","industry","location","major","region","role","school","sub_role","skill","title"];c?-1===u.indexOf(c)&&(o.message="field should be one of: "+u,o.status=400,s(o)):(o.message="Missing field",o.status=400,s(o))}"jobTitle"===a&&(e.jobTitle||(o.message="Missing jobTitle",o.status=400,s(o))),"skill"===a&&(e.skill||(o.message="Missing skill",o.status=400,s(o))),"ip"===a&&(e.ip||(o.message="Missing ip",o.status=400,s(o))),t||(o.message="Missing API Base Path",o.status=400,s(o)),n&&64===n.length||(o.message="Invalid API Key",o.status=401,s(o)),r()})},r=function(e){var t={400:"Request contained either missing or invalid parameters",401:"Request contained a missing or invalid key",402:"Payment Required, You have hit your account maximum (all matches used)",404:"No records were found matching your request",405:"Request method is not allowed on the requested resource",429:"An error occurred due to requests hitting the API too quick",500:"The server encountered an unexpected condition which prevented it from fulfilling the request"};if(e.response){var n=e.response.status,a=n>=500&&n<600?500:n,r=i(e.response);return{status:a,message:t[a],rateLimit:r.rateLimit}}return{status:500,message:t[500]}},s=function(t,s,o,c){return new Promise(function(u,l){a(o,t,s,null,"cleaner").then(function(){e.get(t+"/"+c+"/clean",{params:n({api_key:s},o),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&u(i(e))}).catch(function(e){l(r(e))})}).catch(function(e){l(e)})})},o=function(n,s,o,c,u){return new Promise(function(l,p){a(c,n,o,null,"enrichment").then(function(){var a=c.sandbox&&"person"===u?s+"/"+u+"/enrich":n+"/"+u+"/enrich",h=t(c),d=new URLSearchParams;delete h.sandbox,Object.entries(h).forEach(function(e){var t=e[0],n=e[1];"profile"===t?Array.isArray(n)?d.append(t,JSON.stringify(n)):d.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){d.append(t,e)}):d.append(t,JSON.stringify(n)):d.append(t,n)}),d.append("api_key",o),e.get(a,{params:d,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&l(i(e))}).catch(function(e){p(r(e))})}).catch(function(e){p(e)})})},c=function(t,n,s,o,c,u){return new Promise(function(l,p){a(c,t,s,null,"search").then(function(){var a,h=c.pretty,d=c.sandbox,f=((a={titlecase:c.titlecase||!1,dataset:c.dataset||"all",scroll_token:c.scroll_token||null,size:c.size||10})["sql"===o?"sql":"query"]=c.searchQuery,a.pretty=h||!1,a);e.post(d&&"person"===u?n+"/person/search":t+"/"+u+"/search",f,{headers:{"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":s,"User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&l(i(e))}).catch(function(e){p(r(e))})}).catch(function(e){p(e)})})},u=function(u){var l=this,p=u.apiKey,h=u.basePath,d=u.sandboxBasePath,f=u.version;this.apiKey=void 0,this.basePath=void 0,this.sandboxBasePath=void 0,this.person=void 0,this.company=void 0,this.school=void 0,this.location=void 0,this.autocomplete=void 0,this.skill=void 0,this.jobTitle=void 0,this.ip=void 0,this.apiKey=p,this.basePath=h||"https://api.peopledatalabs.com/"+(f||"v5"),this.sandboxBasePath=d||"https://sandbox.api.peopledatalabs.com/"+(f||"v5"),this.person={enrichment:function(e){return o(l.basePath,l.sandboxBasePath,l.apiKey,e,"person")},enrichmentPreview:function(n){return function(n,s,o,c){return new Promise(function(u,l){a(c,n,o,null,"enrichment").then(function(){var a=c.sandbox?s+"/person/enrich/preview":n+"/person/enrich/preview",p=t(c),h=new URLSearchParams;delete p.sandbox,Object.entries(p).forEach(function(e){var t=e[0],n=e[1];"profile"===t?Array.isArray(n)?h.append(t,JSON.stringify(n)):h.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){h.append(t,e)}):h.append(t,JSON.stringify(n)):h.append(t,n)}),h.append("api_key",o),e.get(a,{params:h,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&u(i(e))}).catch(function(e){l(r(e))})}).catch(function(e){l(e)})})}(l.basePath,l.sandboxBasePath,l.apiKey,n)},search:{elastic:function(e){return c(l.basePath,l.sandboxBasePath,l.apiKey,"elastic",e,"person")},sql:function(e){return c(l.basePath,l.sandboxBasePath,l.apiKey,"sql",e,"person")}},bulk:{enrichment:function(t){return function(t,n,s){var o={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":n,"User-Agent":"PDL-JS-SDK"};return new Promise(function(c,u){a(s,t,n,"Records","bulk").then(function(){e.post(t+"/person/bulk",s,{headers:o}).then(function(e){c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)},retrieve:function(t){return function(t,s,o){var c={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":s,"User-Agent":"PDL-JS-SDK"};return new Promise(function(u,l){a(o,t,s,"Records","bulk").then(function(){var a,s,p=n({},a=o,null==(s=a.filter_updated)?{filter_updated:void 0}:{filter_updated:(Array.isArray(s)?s:[s]).join(",")});e.post(t+"/person/retrieve/bulk",p,{headers:c}).then(function(e){u(i(e))}).catch(function(e){l(r(e))})}).catch(function(e){l(e)})})}(l.basePath,l.apiKey,t)}},identify:function(n){return function(n,s,o,c){return new Promise(function(u,l){a(c,n,o,null,"identify").then(function(){var a=c.sandbox?s+"/person/identify":n+"/person/identify",p=t(c),h=new URLSearchParams;delete p.sandbox,Object.entries(p).forEach(function(e){var t=e[0],n=e[1];"profile"===t?Array.isArray(n)?h.append(t,JSON.stringify(n)):h.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){h.append(t,e)}):h.append(t,JSON.stringify(n)):h.append(t,n)}),h.append("api_key",o),e.get(a,{params:h,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&u(i(e))}).catch(function(e){l(r(e))})}).catch(function(e){l(e)})})}(l.basePath,l.sandboxBasePath,l.apiKey,n)},retrieve:function(t){return function(t,s,o){return new Promise(function(c,u){a(o,t,s,"ID","retrieve").then(function(){var a=function(e){var t=e.filter_updated;return n({},e,null==t?{filter_updated:void 0}:{filter_updated:(Array.isArray(t)?t:[t]).join(",")})}(o);e.get(t+"/person/retrieve/"+o.id,{params:n({api_key:s},a),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)}},this.company={enrichment:function(e){return o(l.basePath,l.sandboxBasePath,l.apiKey,e,"company")},search:{elastic:function(e){return c(l.basePath,l.sandboxBasePath,l.apiKey,"elastic",e,"company")},sql:function(e){return c(l.basePath,l.sandboxBasePath,l.apiKey,"sql",e,"company")}},bulk:{enrichment:function(t){return function(t,n,s){var o={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":n,"User-Agent":"PDL-JS-SDK"};return new Promise(function(c,u){a(s,t,n,"Records","bulk").then(function(){e.post(t+"/company/enrich/bulk",s,{headers:o}).then(function(e){c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)}},cleaner:function(e){return s(l.basePath,l.apiKey,e,"company")}},this.school={cleaner:function(e){return s(l.basePath,l.apiKey,e,"school")}},this.location={cleaner:function(e){return s(l.basePath,l.apiKey,e,"location")}},this.autocomplete=function(t){return function(t,s,o){return new Promise(function(c,u){a(o,t,s,null,"autocomplete").then(function(){e.get(t+"/autocomplete",{params:n({api_key:s},{field:o.field,text:o.text||"",size:o.size||10,pretty:o.pretty||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)},this.jobTitle=function(t){return function(t,s,o){return new Promise(function(c,u){a(o,t,s,null,"jobTitle").then(function(){e.get(t+"/job_title/enrich",{params:n({api_key:s},{job_title:o.jobTitle,pretty:o.pretty||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)},this.skill=function(t){return function(t,s,o){return new Promise(function(c,u){a(o,t,s,null,"skill").then(function(){e.get(t+"/skill/enrich",{params:n({api_key:s},{skill:o.skill,pretty:o.pretty||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)},this.ip=function(t){return function(t,s,o){return new Promise(function(c,u){a(o,t,s,null,"ip").then(function(){e.get(t+"/ip/enrich",{params:n({api_key:s},o),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(i(e))}).catch(function(e){u(r(e))})}).catch(function(e){u(e)})})}(l.basePath,l.apiKey,t)}};export{u as default}; | ||
//# sourceMappingURL=index.m.js.map |
@@ -1,2 +0,2 @@ | ||
import e from"axios";import{copy as t}from"copy-anything";function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},a.apply(this,arguments)}const s=e=>{const t={rateLimitRemaining:e.headers["x-ratelimit-remaining"]?JSON.parse(e.headers["x-ratelimit-remaining"].replace(/'/g,'"')):void 0,rateLimitReset:e.headers["x-ratelimit-reset"]||void 0,rateLimitLimit:e.headers["x-ratelimit-limit"]?JSON.parse(e.headers["x-ratelimit-limit"].replace(/'/g,'"')):void 0,totalLimitOveragesRemaining:e.headers["x-totallimit-overages-remaining"]?Number(e.headers["x-totallimit-overages-remaining"]):void 0,totalLimitPurchasedRemaining:e.headers["x-totallimit-purchased-remaining"]?Number(e.headers["x-totallimit-purchased-remaining"]):void 0,totalLimitRemaining:e.headers["x-totallimit-remaining"]?Number(e.headers["x-totallimit-remaining"]):void 0,callCreditsType:e.headers["x-call-credits-type"]||void 0,callCreditsSpent:e.headers["x-call-credits-spent"]?Number(e.headers["x-call-credits-spent"]):void 0,lifetimeUsed:e.headers["x-lifetime-used"]?Number(e.headers["x-lifetime-used"]):void 0};return Array.isArray(e.data)?{items:e.data,rateLimit:t}:a({},e.data,{rateLimit:t})},i=(e,t,a,s,i)=>new Promise((n,r)=>{const o={};if(e||(o.message=`Missing ${s||"Params"}`,o.status=400,r(o)),"search"===i){const{searchQuery:t}=e;t||(o.message="Missing searchQuery",o.status=400,r(o))}if("retrieve"===i){const{id:t}=e;t||(o.message="Missing id",o.status=400,r(o))}if("autocomplete"===i){const{field:t}=e,a=["company","country","industry","location","major","region","role","school","sub_role","skill","title"];t?-1===a.indexOf(t)&&(o.message=`field should be one of: ${a}`,o.status=400,r(o)):(o.message="Missing field",o.status=400,r(o))}if("jobTitle"===i){const{jobTitle:t}=e;t||(o.message="Missing jobTitle",o.status=400,r(o))}if("skill"===i){const{skill:t}=e;t||(o.message="Missing skill",o.status=400,r(o))}if("ip"===i){const{ip:t}=e;t||(o.message="Missing ip",o.status=400,r(o))}t||(o.message="Missing API Base Path",o.status=400,r(o)),a&&64===a.length||(o.message="Invalid API Key",o.status=401,r(o)),n()}),n=e=>{const t={400:"Request contained either missing or invalid parameters",401:"Request contained a missing or invalid key",402:"Payment Required, You have hit your account maximum (all matches used)",404:"No records were found matching your request",405:"Request method is not allowed on the requested resource",429:"An error occurred due to requests hitting the API too quick",500:"The server encountered an unexpected condition which prevented it from fulfilling the request"};if(e.response){const{status:a}=e.response,i=a>=500&&a<600?500:a,{rateLimit:n}=s(e.response);return{status:i,message:t[i],rateLimit:n}}return{status:500,message:t[500]}};var r=(t,r,o,h)=>new Promise((c,l)=>{i(o,t,r,null,"cleaner").then(()=>{e.get(`${t}/${h}/clean`,{params:a({api_key:r},o),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(s(e))}).catch(e=>{l(n(e))})}).catch(e=>{l(e)})}),o=(a,r,o,h,c)=>new Promise((l,p)=>{i(h,a,o,null,"enrichment").then(()=>{const i=h.sandbox&&"person"===c?`${r}/${c}/enrich`:`${a}/${c}/enrich`,d=t(h),u=new URLSearchParams;delete d.sandbox,Object.entries(d).forEach(([e,t])=>{"profile"===e?Array.isArray(t)?u.append(e,JSON.stringify(t)):u.append(e,t):"object"==typeof t?Array.isArray(t)?t.forEach(t=>{u.append(e,t)}):u.append(e,JSON.stringify(t)):u.append(e,t)}),u.append("api_key",o),e.get(i,{params:u,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&l(s(e))}).catch(e=>{p(n(e))})}).catch(e=>{p(e)})}),h=(t,a,r,o,h,c)=>new Promise((l,p)=>{i(h,t,r,null,"search").then(()=>{const{dataset:i,searchQuery:d,size:u,scroll_token:m,titlecase:y,pretty:g,sandbox:b}=h;e.post(b&&"person"===c?`${a}/person/search`:`${t}/${c}/search`,{titlecase:y||!1,dataset:i||"all",scroll_token:m||null,size:u||10,["sql"===o?"sql":"query"]:d,pretty:g||!1},{headers:{"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":r,"User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&l(s(e))}).catch(e=>{p(n(e))})}).catch(e=>{p(e)})});class c{constructor({apiKey:c,basePath:l,sandboxBasePath:p,version:d}){this.apiKey=void 0,this.basePath=void 0,this.sandboxBasePath=void 0,this.person=void 0,this.company=void 0,this.school=void 0,this.location=void 0,this.autocomplete=void 0,this.skill=void 0,this.jobTitle=void 0,this.ip=void 0,this.apiKey=c,this.basePath=l||`https://api.peopledatalabs.com/${d||"v5"}`,this.sandboxBasePath=p||`https://sandbox.api.peopledatalabs.com/${d||"v5"}`,this.person={enrichment:e=>o(this.basePath,this.sandboxBasePath,this.apiKey,e,"person"),enrichmentPreview:a=>((a,r,o,h)=>new Promise((c,l)=>{i(h,a,o,null,"enrichment").then(()=>{const i=h.sandbox?`${r}/person/enrich/preview`:`${a}/person/enrich/preview`,p=t(h),d=new URLSearchParams;delete p.sandbox,Object.entries(p).forEach(([e,t])=>{"profile"===e?Array.isArray(t)?d.append(e,JSON.stringify(t)):d.append(e,t):"object"==typeof t?Array.isArray(t)?t.forEach(t=>{d.append(e,t)}):d.append(e,JSON.stringify(t)):d.append(e,t)}),d.append("api_key",o),e.get(i,{params:d,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(s(e))}).catch(e=>{l(n(e))})}).catch(e=>{l(e)})}))(this.basePath,this.sandboxBasePath,this.apiKey,a),search:{elastic:e=>h(this.basePath,this.sandboxBasePath,this.apiKey,"elastic",e,"person"),sql:e=>h(this.basePath,this.sandboxBasePath,this.apiKey,"sql",e,"person")},bulk:{enrichment:t=>((t,a,r)=>{const o={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":a,"User-Agent":"PDL-JS-SDK"};return new Promise((h,c)=>{i(r,t,a,"Records","bulk").then(()=>{e.post(`${t}/person/bulk`,r,{headers:o}).then(e=>{h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})})})(this.basePath,this.apiKey,t),retrieve:t=>((t,r,o)=>{const h={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":r,"User-Agent":"PDL-JS-SDK"};return new Promise((c,l)=>{i(o,t,r,"Records","bulk").then(()=>{const i=(e=>{const t=e.filter_updated;return a({},e,null==t?{filter_updated:void 0}:{filter_updated:(Array.isArray(t)?t:[t]).join(",")})})(o);e.post(`${t}/person/retrieve/bulk`,i,{headers:h}).then(e=>{c(s(e))}).catch(e=>{l(n(e))})}).catch(e=>{l(e)})})})(this.basePath,this.apiKey,t)},identify:a=>((a,r,o,h)=>new Promise((c,l)=>{i(h,a,o,null,"identify").then(()=>{const i=h.sandbox?`${r}/person/identify`:`${a}/person/identify`,p=t(h),d=new URLSearchParams;delete p.sandbox,Object.entries(p).forEach(([e,t])=>{"profile"===e?Array.isArray(t)?d.append(e,JSON.stringify(t)):d.append(e,t):"object"==typeof t?Array.isArray(t)?t.forEach(t=>{d.append(e,t)}):d.append(e,JSON.stringify(t)):d.append(e,t)}),d.append("api_key",o),e.get(i,{params:d,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(s(e))}).catch(e=>{l(n(e))})}).catch(e=>{l(e)})}))(this.basePath,this.sandboxBasePath,this.apiKey,a),retrieve:t=>((t,r,o)=>new Promise((h,c)=>{i(o,t,r,"ID","retrieve").then(()=>{const i=(e=>{const t=e.filter_updated;return a({},e,null==t?{filter_updated:void 0}:{filter_updated:(Array.isArray(t)?t:[t]).join(",")})})(o);e.get(`${t}/person/retrieve/${o.id}`,{params:a({api_key:r},i),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})}))(this.basePath,this.apiKey,t)},this.company={enrichment:e=>o(this.basePath,this.sandboxBasePath,this.apiKey,e,"company"),search:{elastic:e=>h(this.basePath,this.sandboxBasePath,this.apiKey,"elastic",e,"company"),sql:e=>h(this.basePath,this.sandboxBasePath,this.apiKey,"sql",e,"company")},cleaner:e=>r(this.basePath,this.apiKey,e,"company")},this.school={cleaner:e=>r(this.basePath,this.apiKey,e,"school")},this.location={cleaner:e=>r(this.basePath,this.apiKey,e,"location")},this.autocomplete=t=>((t,r,o)=>new Promise((h,c)=>{i(o,t,r,null,"autocomplete").then(()=>{const{field:i,text:l,size:p,pretty:d}=o;e.get(`${t}/autocomplete`,{params:a({api_key:r},{field:i,text:l||"",size:p||10,pretty:d||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})}))(this.basePath,this.apiKey,t),this.jobTitle=t=>((t,r,o)=>new Promise((h,c)=>{i(o,t,r,null,"jobTitle").then(()=>{const{jobTitle:i,pretty:l}=o;e.get(`${t}/job_title/enrich`,{params:a({api_key:r},{job_title:i,pretty:l||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})}))(this.basePath,this.apiKey,t),this.skill=t=>((t,r,o)=>new Promise((h,c)=>{i(o,t,r,null,"skill").then(()=>{const{skill:i,pretty:l}=o;e.get(`${t}/skill/enrich`,{params:a({api_key:r},{skill:i,pretty:l||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})}))(this.basePath,this.apiKey,t),this.ip=t=>((t,r,o)=>new Promise((h,c)=>{i(o,t,r,null,"ip").then(()=>{e.get(`${t}/ip/enrich`,{params:a({api_key:r},o),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})}))(this.basePath,this.apiKey,t)}}export{c as default}; | ||
import e from"axios";import{copy as t}from"copy-anything";function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},a.apply(this,arguments)}const s=e=>{const t={rateLimitRemaining:e.headers["x-ratelimit-remaining"]?JSON.parse(e.headers["x-ratelimit-remaining"].replace(/'/g,'"')):void 0,rateLimitReset:e.headers["x-ratelimit-reset"]||void 0,rateLimitLimit:e.headers["x-ratelimit-limit"]?JSON.parse(e.headers["x-ratelimit-limit"].replace(/'/g,'"')):void 0,totalLimitOveragesRemaining:e.headers["x-totallimit-overages-remaining"]?Number(e.headers["x-totallimit-overages-remaining"]):void 0,totalLimitPurchasedRemaining:e.headers["x-totallimit-purchased-remaining"]?Number(e.headers["x-totallimit-purchased-remaining"]):void 0,totalLimitRemaining:e.headers["x-totallimit-remaining"]?Number(e.headers["x-totallimit-remaining"]):void 0,callCreditsType:e.headers["x-call-credits-type"]||void 0,callCreditsSpent:e.headers["x-call-credits-spent"]?Number(e.headers["x-call-credits-spent"]):void 0,lifetimeUsed:e.headers["x-lifetime-used"]?Number(e.headers["x-lifetime-used"]):void 0};return Array.isArray(e.data)?{items:e.data,rateLimit:t}:a({},e.data,{rateLimit:t})},i=(e,t,a,s,i)=>new Promise((n,r)=>{const o={};if(e||(o.message=`Missing ${s||"Params"}`,o.status=400,r(o)),"search"===i){const{searchQuery:t}=e;t||(o.message="Missing searchQuery",o.status=400,r(o))}if("retrieve"===i){const{id:t}=e;t||(o.message="Missing id",o.status=400,r(o))}if("autocomplete"===i){const{field:t}=e,a=["company","country","industry","location","major","region","role","school","sub_role","skill","title"];t?-1===a.indexOf(t)&&(o.message=`field should be one of: ${a}`,o.status=400,r(o)):(o.message="Missing field",o.status=400,r(o))}if("jobTitle"===i){const{jobTitle:t}=e;t||(o.message="Missing jobTitle",o.status=400,r(o))}if("skill"===i){const{skill:t}=e;t||(o.message="Missing skill",o.status=400,r(o))}if("ip"===i){const{ip:t}=e;t||(o.message="Missing ip",o.status=400,r(o))}t||(o.message="Missing API Base Path",o.status=400,r(o)),a&&64===a.length||(o.message="Invalid API Key",o.status=401,r(o)),n()}),n=e=>{const t={400:"Request contained either missing or invalid parameters",401:"Request contained a missing or invalid key",402:"Payment Required, You have hit your account maximum (all matches used)",404:"No records were found matching your request",405:"Request method is not allowed on the requested resource",429:"An error occurred due to requests hitting the API too quick",500:"The server encountered an unexpected condition which prevented it from fulfilling the request"};if(e.response){const{status:a}=e.response,i=a>=500&&a<600?500:a,{rateLimit:n}=s(e.response);return{status:i,message:t[i],rateLimit:n}}return{status:500,message:t[500]}};var r=(t,r,o,h)=>new Promise((c,l)=>{i(o,t,r,null,"cleaner").then(()=>{e.get(`${t}/${h}/clean`,{params:a({api_key:r},o),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(s(e))}).catch(e=>{l(n(e))})}).catch(e=>{l(e)})}),o=(a,r,o,h,c)=>new Promise((l,p)=>{i(h,a,o,null,"enrichment").then(()=>{const i=h.sandbox&&"person"===c?`${r}/${c}/enrich`:`${a}/${c}/enrich`,d=t(h),u=new URLSearchParams;delete d.sandbox,Object.entries(d).forEach(([e,t])=>{"profile"===e?Array.isArray(t)?u.append(e,JSON.stringify(t)):u.append(e,t):"object"==typeof t?Array.isArray(t)?t.forEach(t=>{u.append(e,t)}):u.append(e,JSON.stringify(t)):u.append(e,t)}),u.append("api_key",o),e.get(i,{params:u,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&l(s(e))}).catch(e=>{p(n(e))})}).catch(e=>{p(e)})}),h=(t,a,r,o,h,c)=>new Promise((l,p)=>{i(h,t,r,null,"search").then(()=>{const{dataset:i,searchQuery:d,size:u,scroll_token:m,titlecase:y,pretty:g,sandbox:b}=h;e.post(b&&"person"===c?`${a}/person/search`:`${t}/${c}/search`,{titlecase:y||!1,dataset:i||"all",scroll_token:m||null,size:u||10,["sql"===o?"sql":"query"]:d,pretty:g||!1},{headers:{"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":r,"User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&l(s(e))}).catch(e=>{p(n(e))})}).catch(e=>{p(e)})});class c{constructor({apiKey:c,basePath:l,sandboxBasePath:p,version:d}){this.apiKey=void 0,this.basePath=void 0,this.sandboxBasePath=void 0,this.person=void 0,this.company=void 0,this.school=void 0,this.location=void 0,this.autocomplete=void 0,this.skill=void 0,this.jobTitle=void 0,this.ip=void 0,this.apiKey=c,this.basePath=l||`https://api.peopledatalabs.com/${d||"v5"}`,this.sandboxBasePath=p||`https://sandbox.api.peopledatalabs.com/${d||"v5"}`,this.person={enrichment:e=>o(this.basePath,this.sandboxBasePath,this.apiKey,e,"person"),enrichmentPreview:a=>((a,r,o,h)=>new Promise((c,l)=>{i(h,a,o,null,"enrichment").then(()=>{const i=h.sandbox?`${r}/person/enrich/preview`:`${a}/person/enrich/preview`,p=t(h),d=new URLSearchParams;delete p.sandbox,Object.entries(p).forEach(([e,t])=>{"profile"===e?Array.isArray(t)?d.append(e,JSON.stringify(t)):d.append(e,t):"object"==typeof t?Array.isArray(t)?t.forEach(t=>{d.append(e,t)}):d.append(e,JSON.stringify(t)):d.append(e,t)}),d.append("api_key",o),e.get(i,{params:d,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(s(e))}).catch(e=>{l(n(e))})}).catch(e=>{l(e)})}))(this.basePath,this.sandboxBasePath,this.apiKey,a),search:{elastic:e=>h(this.basePath,this.sandboxBasePath,this.apiKey,"elastic",e,"person"),sql:e=>h(this.basePath,this.sandboxBasePath,this.apiKey,"sql",e,"person")},bulk:{enrichment:t=>((t,a,r)=>{const o={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":a,"User-Agent":"PDL-JS-SDK"};return new Promise((h,c)=>{i(r,t,a,"Records","bulk").then(()=>{e.post(`${t}/person/bulk`,r,{headers:o}).then(e=>{h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})})})(this.basePath,this.apiKey,t),retrieve:t=>((t,r,o)=>{const h={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":r,"User-Agent":"PDL-JS-SDK"};return new Promise((c,l)=>{i(o,t,r,"Records","bulk").then(()=>{const i=(e=>{const t=e.filter_updated;return a({},e,null==t?{filter_updated:void 0}:{filter_updated:(Array.isArray(t)?t:[t]).join(",")})})(o);e.post(`${t}/person/retrieve/bulk`,i,{headers:h}).then(e=>{c(s(e))}).catch(e=>{l(n(e))})}).catch(e=>{l(e)})})})(this.basePath,this.apiKey,t)},identify:a=>((a,r,o,h)=>new Promise((c,l)=>{i(h,a,o,null,"identify").then(()=>{const i=h.sandbox?`${r}/person/identify`:`${a}/person/identify`,p=t(h),d=new URLSearchParams;delete p.sandbox,Object.entries(p).forEach(([e,t])=>{"profile"===e?Array.isArray(t)?d.append(e,JSON.stringify(t)):d.append(e,t):"object"==typeof t?Array.isArray(t)?t.forEach(t=>{d.append(e,t)}):d.append(e,JSON.stringify(t)):d.append(e,t)}),d.append("api_key",o),e.get(i,{params:d,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(s(e))}).catch(e=>{l(n(e))})}).catch(e=>{l(e)})}))(this.basePath,this.sandboxBasePath,this.apiKey,a),retrieve:t=>((t,r,o)=>new Promise((h,c)=>{i(o,t,r,"ID","retrieve").then(()=>{const i=(e=>{const t=e.filter_updated;return a({},e,null==t?{filter_updated:void 0}:{filter_updated:(Array.isArray(t)?t:[t]).join(",")})})(o);e.get(`${t}/person/retrieve/${o.id}`,{params:a({api_key:r},i),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})}))(this.basePath,this.apiKey,t)},this.company={enrichment:e=>o(this.basePath,this.sandboxBasePath,this.apiKey,e,"company"),search:{elastic:e=>h(this.basePath,this.sandboxBasePath,this.apiKey,"elastic",e,"company"),sql:e=>h(this.basePath,this.sandboxBasePath,this.apiKey,"sql",e,"company")},bulk:{enrichment:t=>((t,a,r)=>{const o={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":a,"User-Agent":"PDL-JS-SDK"};return new Promise((h,c)=>{i(r,t,a,"Records","bulk").then(()=>{e.post(`${t}/company/enrich/bulk`,r,{headers:o}).then(e=>{h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})})})(this.basePath,this.apiKey,t)},cleaner:e=>r(this.basePath,this.apiKey,e,"company")},this.school={cleaner:e=>r(this.basePath,this.apiKey,e,"school")},this.location={cleaner:e=>r(this.basePath,this.apiKey,e,"location")},this.autocomplete=t=>((t,r,o)=>new Promise((h,c)=>{i(o,t,r,null,"autocomplete").then(()=>{const{field:i,text:l,size:p,pretty:d}=o;e.get(`${t}/autocomplete`,{params:a({api_key:r},{field:i,text:l||"",size:p||10,pretty:d||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})}))(this.basePath,this.apiKey,t),this.jobTitle=t=>((t,r,o)=>new Promise((h,c)=>{i(o,t,r,null,"jobTitle").then(()=>{const{jobTitle:i,pretty:l}=o;e.get(`${t}/job_title/enrich`,{params:a({api_key:r},{job_title:i,pretty:l||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})}))(this.basePath,this.apiKey,t),this.skill=t=>((t,r,o)=>new Promise((h,c)=>{i(o,t,r,null,"skill").then(()=>{const{skill:i,pretty:l}=o;e.get(`${t}/skill/enrich`,{params:a({api_key:r},{skill:i,pretty:l||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})}))(this.basePath,this.apiKey,t),this.ip=t=>((t,r,o)=>new Promise((h,c)=>{i(o,t,r,null,"ip").then(()=>{e.get(`${t}/ip/enrich`,{params:a({api_key:r},o),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(e=>{var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&h(s(e))}).catch(e=>{c(n(e))})}).catch(e=>{c(e)})}))(this.basePath,this.apiKey,t)}}export{c as default}; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("axios"),require("copy-anything")):"function"==typeof define&&define.amd?define(["axios","copy-anything"],t):(e||self).peopledatalabs=t(e.axios,e.copyAnything)}(this,function(e,t){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/n(e);function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},a.apply(this,arguments)}var r=function(e){var t={rateLimitRemaining:e.headers["x-ratelimit-remaining"]?JSON.parse(e.headers["x-ratelimit-remaining"].replace(/'/g,'"')):void 0,rateLimitReset:e.headers["x-ratelimit-reset"]||void 0,rateLimitLimit:e.headers["x-ratelimit-limit"]?JSON.parse(e.headers["x-ratelimit-limit"].replace(/'/g,'"')):void 0,totalLimitOveragesRemaining:e.headers["x-totallimit-overages-remaining"]?Number(e.headers["x-totallimit-overages-remaining"]):void 0,totalLimitPurchasedRemaining:e.headers["x-totallimit-purchased-remaining"]?Number(e.headers["x-totallimit-purchased-remaining"]):void 0,totalLimitRemaining:e.headers["x-totallimit-remaining"]?Number(e.headers["x-totallimit-remaining"]):void 0,callCreditsType:e.headers["x-call-credits-type"]||void 0,callCreditsSpent:e.headers["x-call-credits-spent"]?Number(e.headers["x-call-credits-spent"]):void 0,lifetimeUsed:e.headers["x-lifetime-used"]?Number(e.headers["x-lifetime-used"]):void 0};return Array.isArray(e.data)?{items:e.data,rateLimit:t}:a({},e.data,{rateLimit:t})},s=function(e,t,n,i,a){return new Promise(function(r,s){var o={};if(e||(o.message="Missing "+(i||"Params"),o.status=400,s(o)),"search"===a&&(e.searchQuery||(o.message="Missing searchQuery",o.status=400,s(o))),"retrieve"===a&&(e.id||(o.message="Missing id",o.status=400,s(o))),"autocomplete"===a){var c=e.field,u=["company","country","industry","location","major","region","role","school","sub_role","skill","title"];c?-1===u.indexOf(c)&&(o.message="field should be one of: "+u,o.status=400,s(o)):(o.message="Missing field",o.status=400,s(o))}"jobTitle"===a&&(e.jobTitle||(o.message="Missing jobTitle",o.status=400,s(o))),"skill"===a&&(e.skill||(o.message="Missing skill",o.status=400,s(o))),"ip"===a&&(e.ip||(o.message="Missing ip",o.status=400,s(o))),t||(o.message="Missing API Base Path",o.status=400,s(o)),n&&64===n.length||(o.message="Invalid API Key",o.status=401,s(o)),r()})},o=function(e){var t={400:"Request contained either missing or invalid parameters",401:"Request contained a missing or invalid key",402:"Payment Required, You have hit your account maximum (all matches used)",404:"No records were found matching your request",405:"Request method is not allowed on the requested resource",429:"An error occurred due to requests hitting the API too quick",500:"The server encountered an unexpected condition which prevented it from fulfilling the request"};if(e.response){var n=e.response.status,i=n>=500&&n<600?500:n,a=r(e.response);return{status:i,message:t[i],rateLimit:a.rateLimit}}return{status:500,message:t[500]}},c=function(e,t,n,c){return new Promise(function(u,l){s(n,e,t,null,"cleaner").then(function(){i.default.get(e+"/"+c+"/clean",{params:a({api_key:t},n),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&u(r(e))}).catch(function(e){l(o(e))})}).catch(function(e){l(e)})})},u=function(e,n,a,c,u){return new Promise(function(l,p){s(c,e,a,null,"enrichment").then(function(){var s=c.sandbox&&"person"===u?n+"/"+u+"/enrich":e+"/"+u+"/enrich",d=t.copy(c),h=new URLSearchParams;delete d.sandbox,Object.entries(d).forEach(function(e){var t=e[0],n=e[1];"profile"===t?Array.isArray(n)?h.append(t,JSON.stringify(n)):h.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){h.append(t,e)}):h.append(t,JSON.stringify(n)):h.append(t,n)}),h.append("api_key",a),i.default.get(s,{params:h,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&l(r(e))}).catch(function(e){p(o(e))})}).catch(function(e){p(e)})})},l=function(e,t,n,a,c,u){return new Promise(function(l,p){s(c,e,n,null,"search").then(function(){var s,d=c.pretty,h=c.sandbox,f=((s={titlecase:c.titlecase||!1,dataset:c.dataset||"all",scroll_token:c.scroll_token||null,size:c.size||10})["sql"===a?"sql":"query"]=c.searchQuery,s.pretty=d||!1,s);i.default.post(h&&"person"===u?t+"/person/search":e+"/"+u+"/search",f,{headers:{"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":n,"User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&l(r(e))}).catch(function(e){p(o(e))})}).catch(function(e){p(e)})})};return function(e){var n=this,p=e.apiKey,d=e.basePath,h=e.sandboxBasePath,f=e.version;this.apiKey=void 0,this.basePath=void 0,this.sandboxBasePath=void 0,this.person=void 0,this.company=void 0,this.school=void 0,this.location=void 0,this.autocomplete=void 0,this.skill=void 0,this.jobTitle=void 0,this.ip=void 0,this.apiKey=p,this.basePath=d||"https://api.peopledatalabs.com/"+(f||"v5"),this.sandboxBasePath=h||"https://sandbox.api.peopledatalabs.com/"+(f||"v5"),this.person={enrichment:function(e){return u(n.basePath,n.sandboxBasePath,n.apiKey,e,"person")},enrichmentPreview:function(e){return function(e,n,a,c){return new Promise(function(u,l){s(c,e,a,null,"enrichment").then(function(){var s=c.sandbox?n+"/person/enrich/preview":e+"/person/enrich/preview",p=t.copy(c),d=new URLSearchParams;delete p.sandbox,Object.entries(p).forEach(function(e){var t=e[0],n=e[1];"profile"===t?Array.isArray(n)?d.append(t,JSON.stringify(n)):d.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){d.append(t,e)}):d.append(t,JSON.stringify(n)):d.append(t,n)}),d.append("api_key",a),i.default.get(s,{params:d,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&u(r(e))}).catch(function(e){l(o(e))})}).catch(function(e){l(e)})})}(n.basePath,n.sandboxBasePath,n.apiKey,e)},search:{elastic:function(e){return l(n.basePath,n.sandboxBasePath,n.apiKey,"elastic",e,"person")},sql:function(e){return l(n.basePath,n.sandboxBasePath,n.apiKey,"sql",e,"person")}},bulk:{enrichment:function(e){return function(e,t,n){var a={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":t,"User-Agent":"PDL-JS-SDK"};return new Promise(function(c,u){s(n,e,t,"Records","bulk").then(function(){i.default.post(e+"/person/bulk",n,{headers:a}).then(function(e){c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)},retrieve:function(e){return function(e,t,n){var c={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":t,"User-Agent":"PDL-JS-SDK"};return new Promise(function(u,l){s(n,e,t,"Records","bulk").then(function(){var t,s,p=a({},t=n,null==(s=t.filter_updated)?{filter_updated:void 0}:{filter_updated:(Array.isArray(s)?s:[s]).join(",")});i.default.post(e+"/person/retrieve/bulk",p,{headers:c}).then(function(e){u(r(e))}).catch(function(e){l(o(e))})}).catch(function(e){l(e)})})}(n.basePath,n.apiKey,e)}},identify:function(e){return function(e,n,a,c){return new Promise(function(u,l){s(c,e,a,null,"identify").then(function(){var s=c.sandbox?n+"/person/identify":e+"/person/identify",p=t.copy(c),d=new URLSearchParams;delete p.sandbox,Object.entries(p).forEach(function(e){var t=e[0],n=e[1];"profile"===t?Array.isArray(n)?d.append(t,JSON.stringify(n)):d.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){d.append(t,e)}):d.append(t,JSON.stringify(n)):d.append(t,n)}),d.append("api_key",a),i.default.get(s,{params:d,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&u(r(e))}).catch(function(e){l(o(e))})}).catch(function(e){l(e)})})}(n.basePath,n.sandboxBasePath,n.apiKey,e)},retrieve:function(e){return function(e,t,n){return new Promise(function(c,u){s(n,e,t,"ID","retrieve").then(function(){var s=function(e){var t=e.filter_updated;return a({},e,null==t?{filter_updated:void 0}:{filter_updated:(Array.isArray(t)?t:[t]).join(",")})}(n);i.default.get(e+"/person/retrieve/"+n.id,{params:a({api_key:t},s),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)}},this.company={enrichment:function(e){return u(n.basePath,n.sandboxBasePath,n.apiKey,e,"company")},search:{elastic:function(e){return l(n.basePath,n.sandboxBasePath,n.apiKey,"elastic",e,"company")},sql:function(e){return l(n.basePath,n.sandboxBasePath,n.apiKey,"sql",e,"company")}},cleaner:function(e){return c(n.basePath,n.apiKey,e,"company")}},this.school={cleaner:function(e){return c(n.basePath,n.apiKey,e,"school")}},this.location={cleaner:function(e){return c(n.basePath,n.apiKey,e,"location")}},this.autocomplete=function(e){return function(e,t,n){return new Promise(function(c,u){s(n,e,t,null,"autocomplete").then(function(){i.default.get(e+"/autocomplete",{params:a({api_key:t},{field:n.field,text:n.text||"",size:n.size||10,pretty:n.pretty||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)},this.jobTitle=function(e){return function(e,t,n){return new Promise(function(c,u){s(n,e,t,null,"jobTitle").then(function(){i.default.get(e+"/job_title/enrich",{params:a({api_key:t},{job_title:n.jobTitle,pretty:n.pretty||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)},this.skill=function(e){return function(e,t,n){return new Promise(function(c,u){s(n,e,t,null,"skill").then(function(){i.default.get(e+"/skill/enrich",{params:a({api_key:t},{skill:n.skill,pretty:n.pretty||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)},this.ip=function(e){return function(e,t,n){return new Promise(function(c,u){s(n,e,t,null,"ip").then(function(){i.default.get(e+"/ip/enrich",{params:a({api_key:t},n),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("axios"),require("copy-anything")):"function"==typeof define&&define.amd?define(["axios","copy-anything"],t):(e||self).peopledatalabs=t(e.axios,e.copyAnything)}(this,function(e,t){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/n(e);function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},a.apply(this,arguments)}var r=function(e){var t={rateLimitRemaining:e.headers["x-ratelimit-remaining"]?JSON.parse(e.headers["x-ratelimit-remaining"].replace(/'/g,'"')):void 0,rateLimitReset:e.headers["x-ratelimit-reset"]||void 0,rateLimitLimit:e.headers["x-ratelimit-limit"]?JSON.parse(e.headers["x-ratelimit-limit"].replace(/'/g,'"')):void 0,totalLimitOveragesRemaining:e.headers["x-totallimit-overages-remaining"]?Number(e.headers["x-totallimit-overages-remaining"]):void 0,totalLimitPurchasedRemaining:e.headers["x-totallimit-purchased-remaining"]?Number(e.headers["x-totallimit-purchased-remaining"]):void 0,totalLimitRemaining:e.headers["x-totallimit-remaining"]?Number(e.headers["x-totallimit-remaining"]):void 0,callCreditsType:e.headers["x-call-credits-type"]||void 0,callCreditsSpent:e.headers["x-call-credits-spent"]?Number(e.headers["x-call-credits-spent"]):void 0,lifetimeUsed:e.headers["x-lifetime-used"]?Number(e.headers["x-lifetime-used"]):void 0};return Array.isArray(e.data)?{items:e.data,rateLimit:t}:a({},e.data,{rateLimit:t})},s=function(e,t,n,i,a){return new Promise(function(r,s){var o={};if(e||(o.message="Missing "+(i||"Params"),o.status=400,s(o)),"search"===a&&(e.searchQuery||(o.message="Missing searchQuery",o.status=400,s(o))),"retrieve"===a&&(e.id||(o.message="Missing id",o.status=400,s(o))),"autocomplete"===a){var c=e.field,u=["company","country","industry","location","major","region","role","school","sub_role","skill","title"];c?-1===u.indexOf(c)&&(o.message="field should be one of: "+u,o.status=400,s(o)):(o.message="Missing field",o.status=400,s(o))}"jobTitle"===a&&(e.jobTitle||(o.message="Missing jobTitle",o.status=400,s(o))),"skill"===a&&(e.skill||(o.message="Missing skill",o.status=400,s(o))),"ip"===a&&(e.ip||(o.message="Missing ip",o.status=400,s(o))),t||(o.message="Missing API Base Path",o.status=400,s(o)),n&&64===n.length||(o.message="Invalid API Key",o.status=401,s(o)),r()})},o=function(e){var t={400:"Request contained either missing or invalid parameters",401:"Request contained a missing or invalid key",402:"Payment Required, You have hit your account maximum (all matches used)",404:"No records were found matching your request",405:"Request method is not allowed on the requested resource",429:"An error occurred due to requests hitting the API too quick",500:"The server encountered an unexpected condition which prevented it from fulfilling the request"};if(e.response){var n=e.response.status,i=n>=500&&n<600?500:n,a=r(e.response);return{status:i,message:t[i],rateLimit:a.rateLimit}}return{status:500,message:t[500]}},c=function(e,t,n,c){return new Promise(function(u,l){s(n,e,t,null,"cleaner").then(function(){i.default.get(e+"/"+c+"/clean",{params:a({api_key:t},n),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&u(r(e))}).catch(function(e){l(o(e))})}).catch(function(e){l(e)})})},u=function(e,n,a,c,u){return new Promise(function(l,p){s(c,e,a,null,"enrichment").then(function(){var s=c.sandbox&&"person"===u?n+"/"+u+"/enrich":e+"/"+u+"/enrich",d=t.copy(c),h=new URLSearchParams;delete d.sandbox,Object.entries(d).forEach(function(e){var t=e[0],n=e[1];"profile"===t?Array.isArray(n)?h.append(t,JSON.stringify(n)):h.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){h.append(t,e)}):h.append(t,JSON.stringify(n)):h.append(t,n)}),h.append("api_key",a),i.default.get(s,{params:h,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&l(r(e))}).catch(function(e){p(o(e))})}).catch(function(e){p(e)})})},l=function(e,t,n,a,c,u){return new Promise(function(l,p){s(c,e,n,null,"search").then(function(){var s,d=c.pretty,h=c.sandbox,f=((s={titlecase:c.titlecase||!1,dataset:c.dataset||"all",scroll_token:c.scroll_token||null,size:c.size||10})["sql"===a?"sql":"query"]=c.searchQuery,s.pretty=d||!1,s);i.default.post(h&&"person"===u?t+"/person/search":e+"/"+u+"/search",f,{headers:{"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":n,"User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&l(r(e))}).catch(function(e){p(o(e))})}).catch(function(e){p(e)})})};return function(e){var n=this,p=e.apiKey,d=e.basePath,h=e.sandboxBasePath,f=e.version;this.apiKey=void 0,this.basePath=void 0,this.sandboxBasePath=void 0,this.person=void 0,this.company=void 0,this.school=void 0,this.location=void 0,this.autocomplete=void 0,this.skill=void 0,this.jobTitle=void 0,this.ip=void 0,this.apiKey=p,this.basePath=d||"https://api.peopledatalabs.com/"+(f||"v5"),this.sandboxBasePath=h||"https://sandbox.api.peopledatalabs.com/"+(f||"v5"),this.person={enrichment:function(e){return u(n.basePath,n.sandboxBasePath,n.apiKey,e,"person")},enrichmentPreview:function(e){return function(e,n,a,c){return new Promise(function(u,l){s(c,e,a,null,"enrichment").then(function(){var s=c.sandbox?n+"/person/enrich/preview":e+"/person/enrich/preview",p=t.copy(c),d=new URLSearchParams;delete p.sandbox,Object.entries(p).forEach(function(e){var t=e[0],n=e[1];"profile"===t?Array.isArray(n)?d.append(t,JSON.stringify(n)):d.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){d.append(t,e)}):d.append(t,JSON.stringify(n)):d.append(t,n)}),d.append("api_key",a),i.default.get(s,{params:d,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&u(r(e))}).catch(function(e){l(o(e))})}).catch(function(e){l(e)})})}(n.basePath,n.sandboxBasePath,n.apiKey,e)},search:{elastic:function(e){return l(n.basePath,n.sandboxBasePath,n.apiKey,"elastic",e,"person")},sql:function(e){return l(n.basePath,n.sandboxBasePath,n.apiKey,"sql",e,"person")}},bulk:{enrichment:function(e){return function(e,t,n){var a={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":t,"User-Agent":"PDL-JS-SDK"};return new Promise(function(c,u){s(n,e,t,"Records","bulk").then(function(){i.default.post(e+"/person/bulk",n,{headers:a}).then(function(e){c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)},retrieve:function(e){return function(e,t,n){var c={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":t,"User-Agent":"PDL-JS-SDK"};return new Promise(function(u,l){s(n,e,t,"Records","bulk").then(function(){var t,s,p=a({},t=n,null==(s=t.filter_updated)?{filter_updated:void 0}:{filter_updated:(Array.isArray(s)?s:[s]).join(",")});i.default.post(e+"/person/retrieve/bulk",p,{headers:c}).then(function(e){u(r(e))}).catch(function(e){l(o(e))})}).catch(function(e){l(e)})})}(n.basePath,n.apiKey,e)}},identify:function(e){return function(e,n,a,c){return new Promise(function(u,l){s(c,e,a,null,"identify").then(function(){var s=c.sandbox?n+"/person/identify":e+"/person/identify",p=t.copy(c),d=new URLSearchParams;delete p.sandbox,Object.entries(p).forEach(function(e){var t=e[0],n=e[1];"profile"===t?Array.isArray(n)?d.append(t,JSON.stringify(n)):d.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){d.append(t,e)}):d.append(t,JSON.stringify(n)):d.append(t,n)}),d.append("api_key",a),i.default.get(s,{params:d,headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&u(r(e))}).catch(function(e){l(o(e))})}).catch(function(e){l(e)})})}(n.basePath,n.sandboxBasePath,n.apiKey,e)},retrieve:function(e){return function(e,t,n){return new Promise(function(c,u){s(n,e,t,"ID","retrieve").then(function(){var s=function(e){var t=e.filter_updated;return a({},e,null==t?{filter_updated:void 0}:{filter_updated:(Array.isArray(t)?t:[t]).join(",")})}(n);i.default.get(e+"/person/retrieve/"+n.id,{params:a({api_key:t},s),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)}},this.company={enrichment:function(e){return u(n.basePath,n.sandboxBasePath,n.apiKey,e,"company")},search:{elastic:function(e){return l(n.basePath,n.sandboxBasePath,n.apiKey,"elastic",e,"company")},sql:function(e){return l(n.basePath,n.sandboxBasePath,n.apiKey,"sql",e,"company")}},bulk:{enrichment:function(e){return function(e,t,n){var a={"Content-Type":"application/json","Accept-Encoding":"gzip","X-Api-Key":t,"User-Agent":"PDL-JS-SDK"};return new Promise(function(c,u){s(n,e,t,"Records","bulk").then(function(){i.default.post(e+"/company/enrich/bulk",n,{headers:a}).then(function(e){c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)}},cleaner:function(e){return c(n.basePath,n.apiKey,e,"company")}},this.school={cleaner:function(e){return c(n.basePath,n.apiKey,e,"school")}},this.location={cleaner:function(e){return c(n.basePath,n.apiKey,e,"location")}},this.autocomplete=function(e){return function(e,t,n){return new Promise(function(c,u){s(n,e,t,null,"autocomplete").then(function(){i.default.get(e+"/autocomplete",{params:a({api_key:t},{field:n.field,text:n.text||"",size:n.size||10,pretty:n.pretty||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)},this.jobTitle=function(e){return function(e,t,n){return new Promise(function(c,u){s(n,e,t,null,"jobTitle").then(function(){i.default.get(e+"/job_title/enrich",{params:a({api_key:t},{job_title:n.jobTitle,pretty:n.pretty||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)},this.skill=function(e){return function(e,t,n){return new Promise(function(c,u){s(n,e,t,null,"skill").then(function(){i.default.get(e+"/skill/enrich",{params:a({api_key:t},{skill:n.skill,pretty:n.pretty||!1}),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)},this.ip=function(e){return function(e,t,n){return new Promise(function(c,u){s(n,e,t,null,"ip").then(function(){i.default.get(e+"/ip/enrich",{params:a({api_key:t},n),headers:{"Accept-Encoding":"gzip","User-Agent":"PDL-JS-SDK"}}).then(function(e){var t;200===(null==e||null==(t=e.data)?void 0:t.status)&&c(r(e))}).catch(function(e){u(o(e))})}).catch(function(e){u(e)})})}(n.basePath,n.apiKey,e)}}}); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -1,2 +0,2 @@ | ||
import { BaseResponse } from './api-types'; | ||
import { BaseResponse } from './api-types.js'; | ||
export type AutoCompleteField = 'company' | 'country' | 'industry' | 'location' | 'major' | 'region' | 'role' | 'school' | 'sub_role' | 'skill' | 'title' | 'website'; | ||
@@ -3,0 +3,0 @@ export interface AutoCompleteParams { |
@@ -1,4 +0,4 @@ | ||
import { BaseResponse, RateLimit } from './api-types'; | ||
import { PersonResponse } from './common-types'; | ||
import { ApiRetrieveMetaParams, RetrieveMetaParams } from './retrieve-types'; | ||
import { BaseResponse, RateLimit } from './api-types.js'; | ||
import { PersonResponse } from './common-types.js'; | ||
import { ApiRetrieveMetaParams, RetrieveMetaParams } from './retrieve-types.js'; | ||
export type BulkPersonRetrieveRequest = { | ||
@@ -5,0 +5,0 @@ id: string; |
@@ -1,3 +0,3 @@ | ||
import { RateLimit } from './api-types'; | ||
import { PersonEnrichmentParams, PersonEnrichmentResponse } from './enrichment-types'; | ||
import { RateLimit } from './api-types.js'; | ||
import { CompanyEnrichmentParams, CompanyEnrichmentResponse, PersonEnrichmentParams, PersonEnrichmentResponse } from './enrichment-types.js'; | ||
export interface BulkPersonEnrichmentRequest { | ||
@@ -21,2 +21,20 @@ params: PersonEnrichmentParams; | ||
}; | ||
export interface BulkCompanyEnrichmentRequest { | ||
params: CompanyEnrichmentParams; | ||
metadata?: unknown; | ||
} | ||
export interface BulkCompanyEnrichmentParams { | ||
requests: Array<BulkCompanyEnrichmentRequest> & { | ||
titlecase?: boolean; | ||
include_if_matched?: boolean; | ||
pretty?: boolean; | ||
}; | ||
} | ||
export interface BulkCompanyEnrichmentResponseItem extends CompanyEnrichmentResponse { | ||
metadata?: unknown; | ||
} | ||
export type BulkCompanyEnrichmentResponse = { | ||
items: Array<BulkCompanyEnrichmentResponseItem>; | ||
rateLimit: RateLimit; | ||
}; | ||
//# sourceMappingURL=bulk-types.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { BaseResponse } from './api-types'; | ||
import { LocationResponse } from './common-types'; | ||
import { RequireAtLeastOne } from './utility-types'; | ||
import { BaseResponse } from './api-types.js'; | ||
import { LocationResponse } from './common-types.js'; | ||
import { RequireAtLeastOne } from './utility-types.js'; | ||
export type CleanerType = 'company' | 'school' | 'location'; | ||
@@ -5,0 +5,0 @@ export type CompanyCleanerParams = RequireAtLeastOne<{ |
@@ -256,2 +256,3 @@ export interface LocationResponse { | ||
id?: string; | ||
linkedin_slug?: string; | ||
founded?: number; | ||
@@ -258,0 +259,0 @@ industry?: string; |
@@ -1,4 +0,4 @@ | ||
import { BaseResponse } from './api-types'; | ||
import { CompanyResponse, PersonResponse } from './common-types'; | ||
import { RequireAtLeastOne } from './utility-types'; | ||
import { BaseResponse } from './api-types.js'; | ||
import { CompanyResponse, PersonResponse } from './common-types.js'; | ||
import { RequireAtLeastOne } from './utility-types.js'; | ||
export type EnrichmentType = 'company' | 'person'; | ||
@@ -12,2 +12,3 @@ export interface EnrichmentAdditionalParams { | ||
sandbox?: boolean; | ||
size?: number; | ||
} | ||
@@ -14,0 +15,0 @@ export type PersonEnrichmentParams = EnrichmentAdditionalParams & Partial<{ |
@@ -1,2 +0,2 @@ | ||
import { RateLimit } from './api-types'; | ||
import { RateLimit } from './api-types.js'; | ||
export type ErrorEndpoint = 'enrichment' | 'autocomplete' | 'search' | 'identify' | 'bulk' | 'cleaner' | 'retrieve' | 'jobTitle' | 'skill' | 'ip'; | ||
@@ -3,0 +3,0 @@ export type PdlError = { |
@@ -1,4 +0,4 @@ | ||
import { BaseResponse } from './api-types'; | ||
import { PersonResponse } from './common-types'; | ||
import { RequireAtLeastOne } from './utility-types'; | ||
import { BaseResponse } from './api-types.js'; | ||
import { PersonResponse } from './common-types.js'; | ||
import { RequireAtLeastOne } from './utility-types.js'; | ||
export type IdentifyRequiredParams = RequireAtLeastOne<{ | ||
@@ -5,0 +5,0 @@ name: string; |
@@ -1,2 +0,2 @@ | ||
import { BaseResponse } from './api-types'; | ||
import { BaseResponse } from './api-types.js'; | ||
export interface IPParams { | ||
@@ -3,0 +3,0 @@ ip: string; |
@@ -1,2 +0,2 @@ | ||
import { BaseResponse } from './api-types'; | ||
import { BaseResponse } from './api-types.js'; | ||
export interface JobTitleParams { | ||
@@ -3,0 +3,0 @@ jobTitle: string; |
@@ -1,3 +0,3 @@ | ||
import { BaseResponse } from './api-types'; | ||
import { PersonResponse } from './common-types'; | ||
import { BaseResponse } from './api-types.js'; | ||
import { PersonResponse } from './common-types.js'; | ||
export type RetrieveFilter = 'job_change' | 'education' | 'location' | 'personal_emails' | 'phone_number' | 'social_profile' | 'work_email'; | ||
@@ -4,0 +4,0 @@ export type RetrieveMetaParams = { |
@@ -1,3 +0,3 @@ | ||
import { BaseResponse } from './api-types'; | ||
import { CompanyResponse, PersonResponse } from './common-types'; | ||
import { BaseResponse } from './api-types.js'; | ||
import { CompanyResponse, PersonResponse } from './common-types.js'; | ||
export interface BaseSearchParams { | ||
@@ -4,0 +4,0 @@ searchQuery?: string | object; |
@@ -1,2 +0,2 @@ | ||
import { BaseResponse } from './api-types'; | ||
import { BaseResponse } from './api-types.js'; | ||
export interface SkillParams { | ||
@@ -3,0 +3,0 @@ skill: string; |
{ | ||
"name": "peopledatalabs", | ||
"version": "6.2.0", | ||
"version": "7.0.0", | ||
"description": "JavaScript client with TypeScript support for the People Data Labs API", | ||
@@ -46,11 +46,11 @@ "type": "module", | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^6.13.1", | ||
"@typescript-eslint/parser": "^6.13.1", | ||
"chai": "^4.3.10", | ||
"@typescript-eslint/eslint-plugin": "^6.18.1", | ||
"@typescript-eslint/parser": "^6.18.1", | ||
"chai": "^5.0.0", | ||
"dotenv": "^16.3.1", | ||
"eslint": "^8.54.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-config-airbnb-typescript": "^17.1.0", | ||
"eslint-plugin-import": "^2.29.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-jsx-a11y": "^6.8.0", | ||
@@ -64,8 +64,8 @@ "eslint-plugin-react": "^7.33.2", | ||
"mocha": "^10.2.0", | ||
"typescript": "^5.3.2" | ||
"typescript": "^5.3.3" | ||
}, | ||
"dependencies": { | ||
"axios": "^1.6.2", | ||
"axios": "^1.6.5", | ||
"copy-anything": "^3.0.5" | ||
} | ||
} |
@@ -198,2 +198,26 @@ <p align="center"> | ||
// By Bulk Enrichment | ||
const bulkEnrichmentRecords = { | ||
requests: [ | ||
{ | ||
params: { | ||
profile: ['linkedin.com/in/peopledatalabs'], | ||
}, | ||
}, | ||
{ | ||
params: { | ||
profile: ['linkedin.com/in/apple'], | ||
}, | ||
}, | ||
], | ||
}; | ||
try { | ||
const response = await PDLJSClient.company.bulk.enrichment(bulkEnrichmentRecords); | ||
console.log(response.items); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
// By Search (SQL) | ||
@@ -388,2 +412,3 @@ const sqlQuery = "SELECT * FROM company WHERE tags='big data' AND industry='financial services' AND location.country='united states';" | ||
| [Company Enrichment API](https://docs.peopledatalabs.com/docs/company-enrichment-api) | `PDLJS.company.enrichment({ ...params })` | | ||
| [Company Bulk Enrichment API](https://docs.peopledatalabs.com/docs/bulk-company-enrichment-api) | `PDLJS.company.bulk.enrichment({ ...records })` | | ||
| [Company Search API](https://docs.peopledatalabs.com/docs/company-search-api) | SQL: `PDLJS.company.search.sql({ ...params })` <br/> Elasticsearch: `PDLJS.company.search.elastic({ ...params })`| | ||
@@ -390,0 +415,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
309326
75
1151
487
31
Updatedaxios@^1.6.5