diff --git a/.gitignore b/.gitignore index eb41880..9195ef1 100644 --- a/.gitignore +++ b/.gitignore @@ -137,3 +137,6 @@ dist .rts2_cache_cjs .rts2_cache_es .rts2_cache_umd + +# VS Code +.vscode diff --git a/package.json b/package.json index d531503..04a2e2a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "peopledatalabs", - "version": "3.1.2", + "version": "3.1.5", "description": "JavaScript client with TypeScript support for the People Data Labs API", "type": "module", "main": "dist/index.cjs", diff --git a/src/types/api-types.ts b/src/types/api-types.ts index 0e19872..391b806 100644 --- a/src/types/api-types.ts +++ b/src/types/api-types.ts @@ -5,13 +5,15 @@ export interface APISettings { } export interface RateLimit { - retryAfter: number; - rateLimit: number; - rateLimitReset: number; - totalLimit?: number; - totalLimitRemaining?: number; - searchLimitRemaining?: number; - enrichCompanyLimitRemaining?: number; + rateLimitRemaining?: string; + rateLimitReset?: string; + rateLimit?: string; + totalLimitOveragesRemaining?: string; + totalLimitPurchasedRemaining?: string; + totalLimitRemaining?: string; + callCreditsType?: string; + callCreditsSpent?: string; + lifetimeUsed?: string; } export interface BaseResponse { diff --git a/src/utils/api-utils.ts b/src/utils/api-utils.ts index 71088a2..219f48a 100644 --- a/src/utils/api-utils.ts +++ b/src/utils/api-utils.ts @@ -4,13 +4,15 @@ import { RateLimit } from '../types/api-types'; // eslint-disable-next-line import/prefer-default-export export const parseRateLimitingResponse = (response: AxiosResponse) => { const rateLimit = { - retryAfter: Number(response.headers['retry-after']) || undefined, - rateLimit: Number(response.headers['x-ratelimit-limit']) || undefined, - rateLimitReset: Number(response.headers['x-ratelimit-reset']) || undefined, - totalLimit: Number(response.headers['x-totallimit-limit']) || undefined, - totalLimitRemaining: Number(response.headers['x-totallimit-remaining']) || undefined, - searchLimitRemaining: Number(response.headers['x-searchlimit-remaining']) || undefined, - enrichCompanyLimitRemaining: Number(response.headers['x-enrichcompanylimit-remaining']) || undefined, + rateLimitRemaining: response.headers['x-ratelimit-remaining'] || undefined, + rateLimitReset: response.headers['x-ratelimit-reset'] || undefined, + rateLimit: response.headers['x-ratelimit-limit'] || undefined, + totalLimitOveragesRemaining: response.headers['x-totallimit-overages-remaining'] || undefined, + totalLimitPurchasedRemaining: response.headers['x-totallimit-purchased-remaining'] || undefined, + totalLimitRemaining: response.headers['x-totallimit-remaining'] || undefined, + callCreditsType: response.headers['x-call-credits-type'] || undefined, + callCreditsSpent: response.headers['x-call-credits-spent'] || undefined, + lifetimeUsed: response.headers['x-lifetime-used'] || undefined, } as RateLimit; if (Array.isArray(response.data)) {