New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

peopledatalabs

Package Overview
Dependencies
Maintainers
0
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

peopledatalabs - npm Package Compare versions

Comparing version

to
10.0.1

2

dist/index.m.js

@@ -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)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},n.apply(null,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=["class","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)):n&&d.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){e&&d.append(t,e)}):n&&d.append(t,JSON.stringify(n)):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)):n&&h.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){e&&h.append(t,e)}):n&&h.append(t,JSON.stringify(n)):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)):n&&h.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){e&&h.append(t,e)}):n&&h.append(t,JSON.stringify(n)):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,titlecase:o.titlecase||!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)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},n.apply(null,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=["class","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)):n&&d.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){e&&d.append(t,e)}):n&&d.append(t,JSON.stringify(n)):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.data_include,d=c.pretty,f=c.sandbox,m=((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=d||!1,a.data_include=h||null,a);e.post(f&&"person"===u?n+"/person/search":t+"/"+u+"/search",m,{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)):n&&h.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){e&&h.append(t,e)}):n&&h.append(t,JSON.stringify(n)):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)):n&&h.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){e&&h.append(t,e)}):n&&h.append(t,JSON.stringify(n)):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,titlecase:o.titlecase||!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)({}).hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},a.apply(null,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=["class","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)):t&&u.append(e,t):"object"==typeof t?Array.isArray(t)?t.forEach(t=>{t&&u.append(e,t)}):t&&u.append(e,JSON.stringify(t)):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,pretty:d,sandbox:u,scroll_token:m,searchQuery:y,size:g,titlecase:b}=h;e.post(u&&"person"===c?`${a}/person/search`:`${t}/${c}/search`,{titlecase:b||!1,dataset:i||"all",scroll_token:m||null,size:g||10,["sql"===o?"sql":"query"]:y,pretty:d||!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)):t&&d.append(e,t):"object"==typeof t?Array.isArray(t)?t.forEach(t=>{t&&d.append(e,t)}):t&&d.append(e,JSON.stringify(t)):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)):t&&d.append(e,t):"object"==typeof t?Array.isArray(t)?t.forEach(t=>{t&&d.append(e,t)}):t&&d.append(e,JSON.stringify(t)):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,pretty:l,size:p,text:d,titlecase:u}=o;e.get(`${t}/autocomplete`,{params:a({api_key:r},{field:i,text:d||"",size:p||10,pretty:l||!1,titlecase:u||!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{pretty:i,skill:l}=o;e.get(`${t}/skill/enrich`,{params:a({api_key:r},{skill:l,pretty:i||!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)({}).hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},a.apply(null,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=["class","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)):t&&u.append(e,t):"object"==typeof t?Array.isArray(t)?t.forEach(t=>{t&&u.append(e,t)}):t&&u.append(e,JSON.stringify(t)):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{data_include:i,dataset:d,pretty:u,sandbox:m,scroll_token:y,searchQuery:g,size:b,titlecase:P}=h;e.post(m&&"person"===c?`${a}/person/search`:`${t}/${c}/search`,{titlecase:P||!1,dataset:d||"all",scroll_token:y||null,size:b||10,["sql"===o?"sql":"query"]:g,pretty:u||!1,data_include:i||null},{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)):t&&d.append(e,t):"object"==typeof t?Array.isArray(t)?t.forEach(t=>{t&&d.append(e,t)}):t&&d.append(e,JSON.stringify(t)):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)):t&&d.append(e,t):"object"==typeof t?Array.isArray(t)?t.forEach(t=>{t&&d.append(e,t)}):t&&d.append(e,JSON.stringify(t)):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,pretty:l,size:p,text:d,titlecase:u}=o;e.get(`${t}/autocomplete`,{params:a({api_key:r},{field:i,text:d||"",size:p||10,pretty:l||!1,titlecase:u||!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{pretty:i,skill:l}=o;e.get(`${t}/skill/enrich`,{params:a({api_key:r},{skill:l,pretty:i||!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)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},a.apply(null,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=["class","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)):n&&h.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){e&&h.append(t,e)}):n&&h.append(t,JSON.stringify(n)):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)):n&&d.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){e&&d.append(t,e)}):n&&d.append(t,JSON.stringify(n)):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)):n&&d.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){e&&d.append(t,e)}):n&&d.append(t,JSON.stringify(n)):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,titlecase:n.titlecase||!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)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},a.apply(null,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=["class","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)):n&&h.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){e&&h.append(t,e)}):n&&h.append(t,JSON.stringify(n)):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.data_include,h=c.pretty,f=c.sandbox,m=((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=h||!1,s.data_include=d||null,s);i.default.post(f&&"person"===u?t+"/person/search":e+"/"+u+"/search",m,{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)):n&&d.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){e&&d.append(t,e)}):n&&d.append(t,JSON.stringify(n)):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)):n&&d.append(t,n):"object"==typeof n?Array.isArray(n)?n.forEach(function(e){e&&d.append(t,e)}):n&&d.append(t,JSON.stringify(n)):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,titlecase:n.titlecase||!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
import { BaseResponse } from './api-types.js';
import { CompanyResponse, PersonResponse } from './common-types.js';
export interface BaseSearchParams {
data_include?: string;
dataset?: string;

@@ -5,0 +6,0 @@ from?: number;

{
"name": "peopledatalabs",
"version": "10.0.0",
"version": "10.0.1",
"description": "JavaScript client with TypeScript support for the People Data Labs API",
"packageManager": "yarn@1.22.22",
"type": "module",

@@ -59,3 +60,3 @@ "main": "dist/index.cjs",

"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-simple-import-sort": "^12.1.1",

@@ -69,8 +70,8 @@ "eslint-plugin-sort-destructure-keys": "^2.0.0",

"mocha": "^11.1.0",
"typescript": "^5.7.3"
"typescript": "^5.8.2"
},
"dependencies": {
"axios": "^1.7.9",
"axios": "^1.8.2",
"copy-anything": "3.0.5"
}
}
<p align="center">
<img src="https://www.peopledatalabs.com/images/company-logo.png" style="background-color: white; padding: 5px 10px;" width="250" alt="People Data Labs Logo">
<img src="https://www.peopledatalabs.com/images/logos/company-logo.png" style="background-color: white; padding: 5px 10px;" width="250" alt="People Data Labs Logo">
</p>

@@ -4,0 +4,0 @@ <h1 align="center">People Data Labs JavaScript Library</h1>

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