Skip to content

Commit ec57c65

Browse files
Merge pull request #2513 from RedisInsight/feature/RI-4852-msgpack-alternative-library
RI-4852 - Use msgpackr alternative library to encode/decode msgpack contents
2 parents b68b353 + 3e46e75 commit ec57c65

File tree

4 files changed

+60
-9
lines changed

4 files changed

+60
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@
225225
"dependencies": {
226226
"@elastic/datemath": "^5.0.3",
227227
"@elastic/eui": "34.6.0",
228-
"@msgpack/msgpack": "^2.7.2",
229228
"@reduxjs/toolkit": "^1.6.2",
230229
"@stablelib/snappy": "^1.0.2",
231230
"axios": "^0.25.0",
@@ -252,6 +251,7 @@
252251
"jsonpath": "^1.1.1",
253252
"lodash": "^4.17.21",
254253
"lz4js": "^0.2.0",
254+
"msgpackr": "^1.9.7",
255255
"pako": "^2.1.0",
256256
"php-serialize": "^4.0.2",
257257
"rawproto": "^0.7.6",

redisinsight/ui/src/utils/formatters/valueFormatters.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { decode, encode } from '@msgpack/msgpack'
1+
import { decode, encode } from 'msgpackr'
22
// eslint-disable-next-line import/order
33
import { Buffer } from 'buffer'
44
import { isUndefined } from 'lodash'
@@ -72,7 +72,7 @@ const formattingBuffer = (
7272
case KeyValueFormat.JSON: return bufferToJSON(reply, props as FormattingProps)
7373
case KeyValueFormat.Msgpack: {
7474
try {
75-
const decoded = decode(reply.data)
75+
const decoded = decode(Uint8Array.from(reply.data))
7676
const value = JSONBigInt.stringify(decoded)
7777
return JSONViewer({ value, ...props })
7878
} catch (e) {
@@ -139,7 +139,7 @@ const bufferToSerializedFormat = (
139139
case KeyValueFormat.JSON: return reSerializeJSON(bufferToUTF8(value), space)
140140
case KeyValueFormat.Msgpack: {
141141
try {
142-
const decoded = decode(value.data)
142+
const decoded = decode(Uint8Array.from(value.data))
143143
const stringified = JSON.stringify(decoded)
144144
return reSerializeJSON(stringified, space)
145145
} catch (e) {

redisinsight/ui/src/utils/tests/formatters/valueFormatters.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { encode } from '@msgpack/msgpack'
1+
import { encode } from 'msgpackr'
22
import { serialize } from 'php-serialize'
33
import { KeyValueFormat } from 'uiSrc/constants'
44
import { anyToBuffer, bufferToSerializedFormat, stringToBuffer, stringToSerializedBufferFormat } from 'uiSrc/utils'

yarn.lock

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,10 +1636,35 @@
16361636
resolved "https://registry.yarnpkg.com/@mdn/browser-compat-data/-/browser-compat-data-3.3.14.tgz#b72a37c654e598f9ae6f8335faaee182bebc6b28"
16371637
integrity sha512-n2RC9d6XatVbWFdHLimzzUJxJ1KY8LdjqrW6YvGPiRmsHkhOUx74/Ct10x5Yo7bC/Jvqx7cDEW8IMPv/+vwEzA==
16381638

1639-
"@msgpack/msgpack@^2.7.2":
1640-
version "2.8.0"
1641-
resolved "https://registry.yarnpkg.com/@msgpack/msgpack/-/msgpack-2.8.0.tgz#4210deb771ee3912964f14a15ddfb5ff877e70b9"
1642-
integrity sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ==
1639+
"@msgpackr-extract/[email protected]":
1640+
version "3.0.2"
1641+
resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.2.tgz#44d752c1a2dc113f15f781b7cc4f53a307e3fa38"
1642+
integrity sha512-9bfjwDxIDWmmOKusUcqdS4Rw+SETlp9Dy39Xui9BEGEk19dDwH0jhipwFzEff/pFg95NKymc6TOTbRKcWeRqyQ==
1643+
1644+
"@msgpackr-extract/[email protected]":
1645+
version "3.0.2"
1646+
resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.2.tgz#f954f34355712212a8e06c465bc06c40852c6bb3"
1647+
integrity sha512-lwriRAHm1Yg4iDf23Oxm9n/t5Zpw1lVnxYU3HnJPTi2lJRkKTrps1KVgvL6m7WvmhYVt/FIsssWay+k45QHeuw==
1648+
1649+
"@msgpackr-extract/[email protected]":
1650+
version "3.0.2"
1651+
resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.2.tgz#45c63037f045c2b15c44f80f0393fa24f9655367"
1652+
integrity sha512-FU20Bo66/f7He9Fp9sP2zaJ1Q8L9uLPZQDub/WlUip78JlPeMbVL8546HbZfcW9LNciEXc8d+tThSJjSC+tmsg==
1653+
1654+
"@msgpackr-extract/[email protected]":
1655+
version "3.0.2"
1656+
resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.2.tgz#35707efeafe6d22b3f373caf9e8775e8920d1399"
1657+
integrity sha512-MOI9Dlfrpi2Cuc7i5dXdxPbFIgbDBGgKR5F2yWEa6FVEtSWncfVNKW5AKjImAQ6CZlBK9tympdsZJ2xThBiWWA==
1658+
1659+
"@msgpackr-extract/[email protected]":
1660+
version "3.0.2"
1661+
resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.2.tgz#091b1218b66c341f532611477ef89e83f25fae4f"
1662+
integrity sha512-gsWNDCklNy7Ajk0vBBf9jEx04RUxuDQfBse918Ww+Qb9HCPoGzS+XJTLe96iN3BVK7grnLiYghP/M4L8VsaHeA==
1663+
1664+
"@msgpackr-extract/[email protected]":
1665+
version "3.0.2"
1666+
resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.2.tgz#0f164b726869f71da3c594171df5ebc1c4b0a407"
1667+
integrity sha512-O+6Gs8UeDbyFpbSh2CPEz/UOrrdWPTBYNblZK5CxxLisYt4kGX3Sc+czffFonyjiGSq3jWLwJS/CCJc7tBr4sQ==
16431668

16441669
"@mswjs/cookies@^0.2.2":
16451670
version "0.2.2"
@@ -10367,6 +10392,27 @@ [email protected], ms@^2.0.0, ms@^2.1.1:
1036710392
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
1036810393
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
1036910394

10395+
msgpackr-extract@^3.0.2:
10396+
version "3.0.2"
10397+
resolved "https://registry.yarnpkg.com/msgpackr-extract/-/msgpackr-extract-3.0.2.tgz#e05ec1bb4453ddf020551bcd5daaf0092a2c279d"
10398+
integrity sha512-SdzXp4kD/Qf8agZ9+iTu6eql0m3kWm1A2y1hkpTeVNENutaB0BwHlSvAIaMxwntmRUAUjon2V4L8Z/njd0Ct8A==
10399+
dependencies:
10400+
node-gyp-build-optional-packages "5.0.7"
10401+
optionalDependencies:
10402+
"@msgpackr-extract/msgpackr-extract-darwin-arm64" "3.0.2"
10403+
"@msgpackr-extract/msgpackr-extract-darwin-x64" "3.0.2"
10404+
"@msgpackr-extract/msgpackr-extract-linux-arm" "3.0.2"
10405+
"@msgpackr-extract/msgpackr-extract-linux-arm64" "3.0.2"
10406+
"@msgpackr-extract/msgpackr-extract-linux-x64" "3.0.2"
10407+
"@msgpackr-extract/msgpackr-extract-win32-x64" "3.0.2"
10408+
10409+
msgpackr@^1.9.7:
10410+
version "1.9.7"
10411+
resolved "https://registry.yarnpkg.com/msgpackr/-/msgpackr-1.9.7.tgz#8f13c06d7a22946a6d8351804ce39a6a9e74ca83"
10412+
integrity sha512-baUNaLvKQvVhzfWTNO07njwbZK1Lxjtb0P1JL6/EhXdLTHzR57/mZqqJC39TtQKvOmkJA4pcejS4dbk7BDgLLA==
10413+
optionalDependencies:
10414+
msgpackr-extract "^3.0.2"
10415+
1037010416
msw@^0.45.0:
1037110417
version "0.45.0"
1037210418
resolved "https://registry.yarnpkg.com/msw/-/msw-0.45.0.tgz#7bab4ff0a03875aa17b7fefd5fbeea0b71f95957"
@@ -10481,6 +10527,11 @@ node-forge@^1:
1048110527
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3"
1048210528
integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==
1048310529

10530+
10531+
version "5.0.7"
10532+
resolved "https://registry.yarnpkg.com/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.7.tgz#5d2632bbde0ab2f6e22f1bbac2199b07244ae0b3"
10533+
integrity sha512-YlCCc6Wffkx0kHkmam79GKvDQ6x+QZkMjFGrIMxgFNILFvGSbCp2fCBC55pGTT9gVaz8Na5CLmxt/urtzRv36w==
10534+
1048410535
node-gyp-build@^4.2.1:
1048510536
version "4.6.0"
1048610537
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.0.tgz#0c52e4cbf54bbd28b709820ef7b6a3c2d6209055"

0 commit comments

Comments
 (0)