Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update non-pjs deps #1407

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@
"@substrate/calc": "^0.3.1",
"argparse": "^2.0.1",
"confmgr": "^1.0.10",
"express": "^4.18.2",
"express": "^4.18.3",
"express-winston": "^4.2.0",
"http-errors": "^2.0.0",
"lru-cache": "^7.13.1",
"prom-client": "^14.2.0",
"lru-cache": "^10.2.0",
"prom-client": "^15.1.0",
"rxjs": "^7.8.1",
"winston": "^3.11.0"
"winston": "^3.12.0"
},
"devDependencies": {
"@substrate/dev": "^0.7.1",
"@types/argparse": "2.0.14",
"@types/argparse": "2.0.15",
"@types/express": "^4.17.21",
"@types/express-serve-static-core": "^4.17.43",
"@types/http-errors": "1.8.2",
"@types/http-errors": "2.0.4",
"@types/lru-cache": "^7.10.10",
"@types/morgan": "1.9.9",
"@types/triple-beam": "^1.3.5",
Expand Down
8 changes: 4 additions & 4 deletions src/chains-config/cache/lruCache.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// Copyright 2017-2024 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
Expand All @@ -14,14 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import LRU from 'lru-cache';
import { LRUCache } from 'lru-cache';

import { IBlock } from '../../types/responses';

export const initLRUCache = (): LRU<string, IBlock> => {
export const initLRUCache = (): LRUCache<string, IBlock> => {
const config = { max: 2 };
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const cache = new LRU(config) as LRU<string, IBlock>;
const cache = new LRUCache(config) as LRUCache<string, IBlock>;

return cache;
};
11 changes: 8 additions & 3 deletions src/services/blocks/BlocksService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type { GenericExtrinsic } from '@polkadot/types';
import type { GenericCall } from '@polkadot/types/generic';
import type { BlockHash, Hash, SignedBlock } from '@polkadot/types/interfaces';
import { BadRequest } from 'http-errors';
import LRU from 'lru-cache';
import { LRUCache } from 'lru-cache';

import { QueryFeeDetailsCache } from '../../chains-config/cache';
import { sanitizeNumbers } from '../../sanitize/sanitizeNumbers';
Expand Down Expand Up @@ -126,7 +126,7 @@ type GetBlock = PromiseRpcResult<(hash?: string | BlockHash | Uint8Array | undef

// LRU cache used to cache blocks
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const cache = new LRU({ max: 2 }) as LRU<string, IBlock>;
const cache = new LRUCache({ max: 2 }) as LRUCache<string, IBlock>;

// Block Service
const blocksService = new BlocksService(mockApi, 0, cache, new QueryFeeDetailsCache(null, null));
Expand Down Expand Up @@ -373,7 +373,12 @@ describe('BlocksService', () => {
});

it('Returns true when queried blockId is canonical', async () => {
const blocksService = new BlocksService(mockApi, 0, new LRU({ max: 2 }), new QueryFeeDetailsCache(null, null));
const blocksService = new BlocksService(
mockApi,
0,
new LRUCache({ max: 2 }),
new QueryFeeDetailsCache(null, null),
);
expect(await blocksService['isFinalizedBlock'](mockApi, blockNumber, finalizedHead, finalizedHead, true)).toEqual(
true,
);
Expand Down
4 changes: 2 additions & 2 deletions src/services/blocks/BlocksService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { blake2AsU8a } from '@polkadot/util-crypto';
import { calc_partial_fee } from '@substrate/calc';
import BN from 'bn.js';
import { BadRequest, InternalServerError } from 'http-errors';
import LRU from 'lru-cache';
import type { LRUCache } from 'lru-cache';

import { QueryFeeDetailsCache } from '../../chains-config/cache';
import {
Expand Down Expand Up @@ -96,7 +96,7 @@ export class BlocksService extends AbstractService {
constructor(
api: ApiPromise,
private minCalcFeeRuntime: IOption<number>,
private blockStore: LRU<string, IBlock>,
private blockStore: LRUCache<string, IBlock>,
private hasQueryFeeApi: QueryFeeDetailsCache,
) {
super(api);
Expand Down
6 changes: 3 additions & 3 deletions src/types/chains-config/ControllerConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// Copyright 2017-2024 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
Expand All @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import LRU from 'lru-cache';
import type { LRUCache } from 'lru-cache';

import { QueryFeeDetailsCache } from '../../chains-config/cache';
import { controllers } from '../../controllers';
Expand Down Expand Up @@ -54,7 +54,7 @@ export interface ControllerOptions {
/**
* LRU cache that stores the 2 most recent queries.
*/
blockStore: LRU<string, IBlock>;
blockStore: LRUCache<string, IBlock>;
/**
* Cache for storing runtime versions that either have queryFeeDetails, or dont.
*/
Expand Down
111 changes: 56 additions & 55 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,13 @@ __metadata:
languageName: node
linkType: hard

"@opentelemetry/api@npm:^1.4.0":
version: 1.8.0
resolution: "@opentelemetry/api@npm:1.8.0"
checksum: 10/62f0c42711b9f0c56ea9527c2e6e609e371bfb47d0b78956c91fe27365b4744d7dcc407636ef5b19a24a1d5e2c3cfa79c1b715deca829074e24e3ffba1315ba2
languageName: node
linkType: hard

"@pkgjs/parseargs@npm:^0.11.0":
version: 0.11.0
resolution: "@pkgjs/parseargs@npm:0.11.0"
Expand Down Expand Up @@ -1459,23 +1466,23 @@ __metadata:
"@polkadot/util-crypto": "npm:^12.6.2"
"@substrate/calc": "npm:^0.3.1"
"@substrate/dev": "npm:^0.7.1"
"@types/argparse": "npm:2.0.14"
"@types/argparse": "npm:2.0.15"
"@types/express": "npm:^4.17.21"
"@types/express-serve-static-core": "npm:^4.17.43"
"@types/http-errors": "npm:1.8.2"
"@types/http-errors": "npm:2.0.4"
"@types/lru-cache": "npm:^7.10.10"
"@types/morgan": "npm:1.9.9"
"@types/triple-beam": "npm:^1.3.5"
argparse: "npm:^2.0.1"
confmgr: "npm:^1.0.10"
express: "npm:^4.18.2"
express: "npm:^4.18.3"
express-winston: "npm:^4.2.0"
http-errors: "npm:^2.0.0"
lru-cache: "npm:^7.13.1"
prom-client: "npm:^14.2.0"
lru-cache: "npm:^10.2.0"
prom-client: "npm:^15.1.0"
rxjs: "npm:^7.8.1"
ts-node-dev: "npm:^2.0.0"
winston: "npm:^3.11.0"
winston: "npm:^3.12.0"
bin:
substrate-api-sidecar: ./build/src/main.js
languageName: unknown
Expand Down Expand Up @@ -1602,10 +1609,10 @@ __metadata:
languageName: node
linkType: hard

"@types/argparse@npm:2.0.14":
version: 2.0.14
resolution: "@types/argparse@npm:2.0.14"
checksum: 10/1eba6ad70904f79a7c475cbdde74fead2db84dbda58e9e7329dbc6df5569812205e844925713175d264b321e0d5908f3a828615528823217775d043ef27cca36
"@types/argparse@npm:2.0.15":
version: 2.0.15
resolution: "@types/argparse@npm:2.0.15"
checksum: 10/b3a5fe0c8e733f95ceaf49c40ae73d0350a79751bdbd9cc17ca81f7da016cc136644d82810de393c7a30350cad8bc381a359433e2e7b11baaf7cc33da3b7d418
languageName: node
linkType: hard

Expand Down Expand Up @@ -1711,17 +1718,10 @@ __metadata:
languageName: node
linkType: hard

"@types/http-errors@npm:*":
version: 2.0.1
resolution: "@types/http-errors@npm:2.0.1"
checksum: 10/3bb0c50b0a652e679a84c30cd0340d696c32ef6558518268c238840346c077f899315daaf1c26c09c57ddd5dc80510f2a7f46acd52bf949e339e35ed3ee9654f
languageName: node
linkType: hard

"@types/http-errors@npm:1.8.2":
version: 1.8.2
resolution: "@types/http-errors@npm:1.8.2"
checksum: 10/ecc365eea98d7eca650d593e742571acc3003742f0dd0fbbb15b8fce286e0f7421644b4140fb9bf701bbb7f1b744aea3967ebe025f0f0811aa5ab2c3d40fe111
"@types/http-errors@npm:*, @types/http-errors@npm:2.0.4":
version: 2.0.4
resolution: "@types/http-errors@npm:2.0.4"
checksum: 10/1f3d7c3b32c7524811a45690881736b3ef741bf9849ae03d32ad1ab7062608454b150a4e7f1351f83d26a418b2d65af9bdc06198f1c079d75578282884c4e8e3
languageName: node
linkType: hard

Expand Down Expand Up @@ -2340,23 +2340,23 @@ __metadata:
languageName: node
linkType: hard

"body-parser@npm:1.20.1":
version: 1.20.1
resolution: "body-parser@npm:1.20.1"
"body-parser@npm:1.20.2":
version: 1.20.2
resolution: "body-parser@npm:1.20.2"
dependencies:
bytes: "npm:3.1.2"
content-type: "npm:~1.0.4"
content-type: "npm:~1.0.5"
debug: "npm:2.6.9"
depd: "npm:2.0.0"
destroy: "npm:1.2.0"
http-errors: "npm:2.0.0"
iconv-lite: "npm:0.4.24"
on-finished: "npm:2.4.1"
qs: "npm:6.11.0"
raw-body: "npm:2.5.1"
raw-body: "npm:2.5.2"
type-is: "npm:~1.6.18"
unpipe: "npm:1.0.0"
checksum: 10/5f8d128022a2fb8b6e7990d30878a0182f300b70e46b3f9d358a9433ad6275f0de46add6d63206da3637c01c3b38b6111a7480f7e7ac2e9f7b989f6133fe5510
checksum: 10/3cf171b82190cf91495c262b073e425fc0d9e25cc2bf4540d43f7e7bbca27d6a9eae65ca367b6ef3993eea261159d9d2ab37ce444e8979323952e12eb3df319a
languageName: node
linkType: hard

Expand Down Expand Up @@ -2716,7 +2716,7 @@ __metadata:
languageName: node
linkType: hard

"content-type@npm:~1.0.4":
"content-type@npm:~1.0.4, content-type@npm:~1.0.5":
version: 1.0.5
resolution: "content-type@npm:1.0.5"
checksum: 10/585847d98dc7fb8035c02ae2cb76c7a9bd7b25f84c447e5ed55c45c2175e83617c8813871b4ee22f368126af6b2b167df655829007b21aa10302873ea9c62662
Expand Down Expand Up @@ -3312,13 +3312,13 @@ __metadata:
languageName: node
linkType: hard

"express@npm:^4.18.2":
version: 4.18.2
resolution: "express@npm:4.18.2"
"express@npm:^4.18.3":
version: 4.18.3
resolution: "express@npm:4.18.3"
dependencies:
accepts: "npm:~1.3.8"
array-flatten: "npm:1.1.1"
body-parser: "npm:1.20.1"
body-parser: "npm:1.20.2"
content-disposition: "npm:0.5.4"
content-type: "npm:~1.0.4"
cookie: "npm:0.5.0"
Expand Down Expand Up @@ -3347,7 +3347,7 @@ __metadata:
type-is: "npm:~1.6.18"
utils-merge: "npm:1.0.1"
vary: "npm:~1.1.2"
checksum: 10/869ae89ed6ff4bed7b373079dc58e5dddcf2915a2669b36037ff78c99d675ae930e5fe052b35c24f56557d28a023bb1cbe3e2f2fb87eaab96a1cedd7e597809d
checksum: 10/0bf4656d0020cdc477aec884c6245dceea78992f6c747c899c87dbb0598474658d4130a29c80f02c99d1f0d6ebef706e7131c70c5454c3e07aba761c5bd3d627
languageName: node
linkType: hard

Expand Down Expand Up @@ -4768,10 +4768,10 @@ __metadata:
languageName: node
linkType: hard

"lru-cache@npm:*, lru-cache@npm:^9.1.1 || ^10.0.0":
version: 10.0.1
resolution: "lru-cache@npm:10.0.1"
checksum: 10/5bb91a97a342a41fd049c3494b44d9e21a7d4843f9284d0a0b26f00bb0e436f1f627d0641c78f88be16b86b4231546c5ee4f284733fb530c7960f0bcd7579026
"lru-cache@npm:*, lru-cache@npm:^10.2.0, lru-cache@npm:^9.1.1 || ^10.0.0":
version: 10.2.0
resolution: "lru-cache@npm:10.2.0"
checksum: 10/502ec42c3309c0eae1ce41afca471f831c278566d45a5273a0c51102dee31e0e250a62fa9029c3370988df33a14188a38e682c16143b794de78668de3643e302
languageName: node
linkType: hard

Expand All @@ -4793,7 +4793,7 @@ __metadata:
languageName: node
linkType: hard

"lru-cache@npm:^7.13.1, lru-cache@npm:^7.7.1":
"lru-cache@npm:^7.7.1":
version: 7.18.3
resolution: "lru-cache@npm:7.18.3"
checksum: 10/6029ca5aba3aacb554e919d7ef804fffd4adfc4c83db00fac8248c7c78811fb6d4b6f70f7fd9d55032b3823446546a007edaa66ad1f2377ae833bd983fac5d98
Expand Down Expand Up @@ -5487,12 +5487,13 @@ __metadata:
languageName: node
linkType: hard

"prom-client@npm:^14.2.0":
version: 14.2.0
resolution: "prom-client@npm:14.2.0"
"prom-client@npm:^15.1.0":
version: 15.1.0
resolution: "prom-client@npm:15.1.0"
dependencies:
"@opentelemetry/api": "npm:^1.4.0"
tdigest: "npm:^0.1.1"
checksum: 10/892eb83eb860945f3ee55bc19bb73e4a64cb63d95e28336141f49fb90a05354765b4ac4a8ba046fd895690f0bf231de1289caf180647cefdfd0d767f34725d97
checksum: 10/ecb6f40de755ca9cc6dde758d195ed3e1d3b47a341d2092af8c18dbf7e6ef1079c8b8bb02496f2f430cf8bd9d391c1ea5bebbb85cdda95f67dad2dbfb90509aa
languageName: node
linkType: hard

Expand Down Expand Up @@ -5570,15 +5571,15 @@ __metadata:
languageName: node
linkType: hard

"raw-body@npm:2.5.1":
version: 2.5.1
resolution: "raw-body@npm:2.5.1"
"raw-body@npm:2.5.2":
version: 2.5.2
resolution: "raw-body@npm:2.5.2"
dependencies:
bytes: "npm:3.1.2"
http-errors: "npm:2.0.0"
iconv-lite: "npm:0.4.24"
unpipe: "npm:1.0.0"
checksum: 10/280bedc12db3490ecd06f740bdcf66093a07535374b51331242382c0e130bb273ebb611b7bc4cba1b4b4e016cc7b1f4b05a6df885a6af39c2bc3b94c02291c84
checksum: 10/863b5171e140546a4d99f349b720abac4410338e23df5e409cfcc3752538c9caf947ce382c89129ba976f71894bd38b5806c774edac35ebf168d02aa1ac11a95
languageName: node
linkType: hard

Expand Down Expand Up @@ -6577,20 +6578,20 @@ __metadata:
languageName: node
linkType: hard

"winston-transport@npm:^4.5.0":
version: 4.5.0
resolution: "winston-transport@npm:4.5.0"
"winston-transport@npm:^4.7.0":
version: 4.7.0
resolution: "winston-transport@npm:4.7.0"
dependencies:
logform: "npm:^2.3.2"
readable-stream: "npm:^3.6.0"
triple-beam: "npm:^1.3.0"
checksum: 10/3184b7f29fa97aac5b75ff680100656116aff8d164c09bc7459c9b7cb1ce47d02254caf96c2293791ec175c0e76e5ff59b5ed1374733e0b46248cf4f68a182fc
checksum: 10/c8eae7b110e68396edcf26aec86608bd8ac98f3cc05961064e2e577b023d9c4aa485546cacba84efaf48b7d6b1e282dc211fd959ee16cbd31d34476d96daea43
languageName: node
linkType: hard

"winston@npm:^3.11.0":
version: 3.11.0
resolution: "winston@npm:3.11.0"
"winston@npm:^3.12.0":
version: 3.12.0
resolution: "winston@npm:3.12.0"
dependencies:
"@colors/colors": "npm:^1.6.0"
"@dabh/diagnostics": "npm:^2.0.2"
Expand All @@ -6602,8 +6603,8 @@ __metadata:
safe-stable-stringify: "npm:^2.3.1"
stack-trace: "npm:0.0.x"
triple-beam: "npm:^1.3.0"
winston-transport: "npm:^4.5.0"
checksum: 10/8b456bdfbf336898c5a7ca83b5c312fe46f32830c759e231f950378c28a0ddd0780e64ceaf6ea76e0366fb1500b49b9fee80d1045e41efc3b03b51ad31eeb307
winston-transport: "npm:^4.7.0"
checksum: 10/df4ffb509a489e72d457749f0e03c588e492af3ae946c47b47d8ec9aef83c59ec70d0deaa7d366df38d936dd10374d4b0a87e1a871e8d02b4cd4d65a518b40f7
languageName: node
linkType: hard

Expand Down
Loading