1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Upgrade jsonpath package

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-08-17 08:29:05 -04:00
parent 3e02229920
commit 7d3febd974
3 changed files with 24 additions and 34 deletions

View File

@ -208,7 +208,6 @@
}
},
"dependencies": {
"@astronautlabs/jsonpath": "^1.1.0",
"@hapi/call": "^9.0.0",
"@hapi/subtext": "^7.0.4",
"@kubernetes/client-node": "^0.17.0",
@ -243,6 +242,7 @@
"joi": "^17.6.0",
"js-yaml": "^4.1.0",
"jsdom": "^16.7.0",
"jsonpath": "^1.1.1",
"lodash": "^4.17.15",
"mac-ca": "^1.0.6",
"marked": "^4.0.18",
@ -320,6 +320,7 @@
"@types/jest": "^28.1.6",
"@types/js-yaml": "^4.0.5",
"@types/jsdom": "^16.2.14",
"@types/jsonpath": "^0.2.0",
"@types/lodash": "^4.14.181",
"@types/marked": "^4.0.3",
"@types/md5-file": "^4.0.2",

View File

@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { JSONPath } from "@astronautlabs/jsonpath";
import jsonpath from "jsonpath";
import { TypedRegEx } from "typed-regex";
const slashDashSearch = /[\\-]/g;
@ -90,9 +90,9 @@ function formatJSONValue(value: unknown) {
*/
export function safeJSONPathValue(obj: object, path: string): string {
try {
const parsedPath = JSONPath.parse(convertKubectlJsonPathToNodeJsonPath(path));
const parsedPath = jsonpath.parse(convertKubectlJsonPathToNodeJsonPath(path));
const isSlice = parsedPath.some((exp: any) => exp.expression.type === "slice" || "wildcard");
const value = JSONPath.query(obj, JSONPath.stringify(parsedPath), isSlice ? Infinity : 1);
const value = jsonpath.query(obj, jsonpath.stringify(parsedPath), isSlice ? Infinity : 1);
if (isSlice) {
return value.map(formatJSONValue).join(", ");

View File

@ -15,17 +15,6 @@
"@jridgewell/gen-mapping" "^0.1.0"
"@jridgewell/trace-mapping" "^0.3.9"
"@astronautlabs/jsonpath@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@astronautlabs/jsonpath/-/jsonpath-1.1.0.tgz#9b4b04603be2e858d0763619ab3f9d1050b52ef3"
integrity sha512-I4sckUQNYEeF4w6AkujiRblVzC0jo3ja+bxKHB1M2aFiaBjevSGlBdgZ80PgCX5sj65/AhKSFN9+cT908avBlQ==
dependencies:
"@types/esprima" "^4.0.2"
"@types/mkdirp" "^1.0.0"
esprima "1.2.2"
static-eval "2.0.2"
underscore "1.7.0"
"@async-fn/jest@1.6.4":
version "1.6.4"
resolved "https://registry.yarnpkg.com/@async-fn/jest/-/jest-1.6.4.tgz#202f6a070847123e81c7c6bd5bee5a8f12ebbd40"
@ -1842,13 +1831,6 @@
"@types/estree" "*"
"@types/json-schema" "*"
"@types/esprima@^4.0.2":
version "4.0.3"
resolved "https://registry.yarnpkg.com/@types/esprima/-/esprima-4.0.3.tgz#e9068297cc3dd75231fa5cdaa6d75c50d5fb632f"
integrity sha512-jo14dIWVVtF0iMsKkYek6++4cWJjwpvog+rchLulwgFJGTXqIeTdCOvY0B3yMLTaIwMcKCdJ6mQbSR6wYHy98A==
dependencies:
"@types/estree" "*"
"@types/estree@*", "@types/estree@^0.0.51":
version "0.0.51"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.51.tgz#cfd70924a25a3fd32b218e5e420e6897e1ac4f40"
@ -2032,6 +2014,11 @@
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=
"@types/jsonpath@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@types/jsonpath/-/jsonpath-0.2.0.tgz#13c62db22a34d9c411364fac79fd374d63445aa1"
integrity sha512-v7qlPA0VpKUlEdhghbDqRoKMxFB3h3Ch688TApBJ6v+XLDdvWCGLJIYiPKGZnS6MAOie+IorCfNYVHOPIHSWwQ==
"@types/keyv@*":
version "3.1.4"
resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.4.tgz#3ccdb1c6751b0c7e52300bcdacd5bcbf8faa75b6"
@ -2078,13 +2065,6 @@
dependencies:
"@types/node" "*"
"@types/mkdirp@^1.0.0":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-1.0.2.tgz#8d0bad7aa793abe551860be1f7ae7f3198c16666"
integrity sha512-o0K1tSO0Dx5X6xlU5F1D6625FawhC3dU3iqr25lluNv/+/QIVH8RLNEiVokgIZo+mz+87w/3Mkg/VvQS+J51fQ==
dependencies:
"@types/node" "*"
"@types/mock-fs@^4.13.1":
version "4.13.1"
resolved "https://registry.yarnpkg.com/@types/mock-fs/-/mock-fs-4.13.1.tgz#9201554ceb23671badbfa8ac3f1fa9e0706305be"
@ -5875,7 +5855,7 @@ espree@^9.3.2, espree@^9.3.3:
esprima@1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.2.2.tgz#76a0fd66fcfe154fd292667dc264019750b1657b"
integrity sha1-dqD9Zvz+FU/SkmZ9wmQBl1CxZXs=
integrity sha512-+JpPZam9w5DuJ3Q67SqsMGtiHKENSMRVoxvArfJZK01/BfLEObtZ6orJa/MtoGNR/rfMgp5837T41PAmTwAv/A==
esprima@^4.0.0, esprima@^4.0.1:
version "4.0.1"
@ -8537,6 +8517,15 @@ jsonpath-plus@^0.19.0:
resolved "https://registry.yarnpkg.com/jsonpath-plus/-/jsonpath-plus-0.19.0.tgz#b901e57607055933dc9a8bef0cc25160ee9dd64c"
integrity sha512-GSVwsrzW9LsA5lzsqe4CkuZ9wp+kxBb2GwNniaWzI2YFn5Ig42rSW8ZxVpWXaAfakXNrx5pgY5AbQq7kzX29kg==
jsonpath@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/jsonpath/-/jsonpath-1.1.1.tgz#0ca1ed8fb65bb3309248cc9d5466d12d5b0b9901"
integrity sha512-l6Cg7jRpixfbgoWgkrl77dgEj8RPvND0wMH6TwQmi9Qs4TFfS9u5cUFnbeKTwj5ga5Y3BTGGNI28k117LJ009w==
dependencies:
esprima "1.2.2"
static-eval "2.0.2"
underscore "1.12.1"
jsprim@^1.2.2:
version "1.4.2"
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.2.tgz#712c65533a15c878ba59e9ed5f0e26d5b77c5feb"
@ -13443,10 +13432,10 @@ undefsafe@^2.0.5:
resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c"
integrity sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==
underscore@1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.7.0.tgz#6bbaf0877500d36be34ecaa584e0db9fef035209"
integrity sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=
underscore@1.12.1:
version "1.12.1"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.12.1.tgz#7bb8cc9b3d397e201cf8553336d262544ead829e"
integrity sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==
underscore@^1.9.1:
version "1.13.3"