Skip to content

Commit

Permalink
upgrade to 3.5.0 fixing lru typescript issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
UmanShahzad committed Oct 23, 2023
1 parent 96d8854 commit 53e62fd
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 35 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 3.5.0

- Upgrades underlying default LRU cache library to fix typescript errors (v6
didn't provide types, but v7 and above do natively).

## 3.4.6

- Last version (3.4.5) incorrectly published a bad dist output due to buggy
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ import IPinfoWrapper, { LruCache, Options } from "node-ipinfo";

const cacheOptions: Options<string, any> = {
max: 5000,
maxAge: 24 * 1000 * 60 * 60,
ttl: 24 * 1000 * 60 * 60,
};
const cache = new LruCache(cacheOptions);
const ipinfoWrapper = new IPinfoWrapper("MY_TOKEN", cache);
Expand All @@ -93,7 +93,7 @@ const { IPinfoWrapper, LruCache } = require("node-ipinfo");

const cacheOptions = {
max: 5000,
maxAge: 24 * 1000 * 60 * 60,
ttl: 24 * 1000 * 60 * 60,
};
const cache = new LruCache(cacheOptions);
const ipinfo = new IPinfoWrapper("MY_TOKEN", cache);
Expand Down
12 changes: 6 additions & 6 deletions __tests__/ipinfoWrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe("IPinfoWrapper", () => {
},
company: {
name: "Level 3 Communications, Inc.",
domain: "lumen.com",
domain: "level3.com",
type: "isp"
},
privacy: {
Expand All @@ -147,13 +147,13 @@ describe("IPinfoWrapper", () => {
},
domains: {
ip: "4.4.4.4",
total: 119,
total: 127,
domains: [
"ncrsaas.com",
"datacenterteam.de",
"lavu-pos.com",
"prodygy.biz",
"giacomoni.ca",
"fbidiy.net",
"innnn.in",
"safermoto.com",
"shaoshuaitest0614.net",
]
},
countryCode: "US"
Expand Down
63 changes: 43 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-ipinfo",
"version": "3.4.6",
"version": "3.5.0",
"description": "Official Node client library for IPinfo",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down Expand Up @@ -30,11 +30,10 @@
"node": ">=10"
},
"dependencies": {
"lru-cache": "^6.0.0",
"lru-cache": "^7.18.3",
"subnet-check": "^1.10.1"
},
"devDependencies": {
"@types/lru-cache": "^7.10.10",
"@types/jest": "^29.5.3",
"@types/node": "^18.15.0",
"dotenv": "^8.6.0",
Expand Down
2 changes: 1 addition & 1 deletion src/cache/lruCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const cacheOptions: Options<string, any> = {
max: 5000,

// The maximum life of a cached item in milliseconds.
maxAge: 24 * 1000 * 60 * 60
ttl: 24 * 1000 * 60 * 60
};

export default class LruCache implements IPCache {
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const VERSION = "3.4.6";
const VERSION = "3.5.0";

export default VERSION;
2 changes: 1 addition & 1 deletion test-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let { IPinfoWrapper, LruCache } = require("node-ipinfo");

let cacheOptions = {
max: 5000,
maxAge: 24 * 1000 * 60 * 60,
ttl: 24 * 1000 * 60 * 60,
};
let cache = new LruCache(cacheOptions);

Expand Down
2 changes: 1 addition & 1 deletion test-app/ipinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import IPinfoWrapper, { LruCache, Options, IPinfo, AsnResponse } from "node-ipin

const cacheOptions: Options<string, any> = {
max: 5000,
maxAge: 24 * 1000 * 60 * 60,
ttl: 24 * 1000 * 60 * 60,
};
const cache = new LruCache(cacheOptions);

Expand Down

0 comments on commit 53e62fd

Please sign in to comment.