From 0c30b4d2e1e7ca97ab751cb5a7eb3d3bc2181e19 Mon Sep 17 00:00:00 2001 From: Raj Potla Date: Fri, 2 Aug 2024 15:38:16 -0700 Subject: [PATCH 1/2] revert Axios --- package-lock.json | 71 ++++++++++++++----------------------- package.json | 5 ++- src/Adapters/ADTAdapter.ts | 10 +++--- src/Adapters/ADXAdapter.ts | 7 ++-- src/Adapters/BlobAdapter.ts | 8 ++--- 5 files changed, 38 insertions(+), 63 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2ad356537..909a6d628 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@types/react-transition-group": "^4.4.2", "@web3-storage/parse-link-header": "^3.1.0", "ajv": "^8.10.0", - "axios": "^0.28.0", + "axios": "^0.21.1", "axios-retry": "^3.1.9", "azure-iot-dtdl-parser": "^0.0.1-beta.0", "constantinople": "^4.0.1", @@ -14501,6 +14501,7 @@ }, "node_modules/asynckit": { "version": "0.4.0", + "dev": true, "license": "MIT" }, "node_modules/at-least-node": { @@ -14624,13 +14625,11 @@ } }, "node_modules/axios": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.28.1.tgz", - "integrity": "sha512-iUcGA5a7p0mVb4Gm/sy+FSECNkPFT4y7wt6OM/CDpO/OnNCvSs3PoMG8ibrC9jRoGYU0gUK5pXVC4NPXq6lHRQ==", + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" + "follow-redirects": "^1.14.0" } }, "node_modules/axios-retry": { @@ -14640,19 +14639,6 @@ "is-retry-allowed": "^1.1.0" } }, - "node_modules/axios/node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/azure-iot-dtdl-parser": { "version": "0.0.1-beta.0", "resolved": "https://registry.npmjs.org/azure-iot-dtdl-parser/-/azure-iot-dtdl-parser-0.0.1-beta.0.tgz", @@ -16442,6 +16428,7 @@ }, "node_modules/combined-stream": { "version": "1.0.8", + "dev": true, "license": "MIT", "dependencies": { "delayed-stream": "~1.0.0" @@ -17974,6 +17961,7 @@ }, "node_modules/delayed-stream": { "version": "1.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=0.4.0" @@ -26389,6 +26377,7 @@ "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, "engines": { "node": ">= 0.6" } @@ -26397,6 +26386,7 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, "dependencies": { "mime-db": "1.52.0" }, @@ -29336,7 +29326,8 @@ "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true }, "node_modules/psl": { "version": "1.8.0", @@ -37256,7 +37247,7 @@ "version": "2.0.4", "dev": true, "requires": { - "axios": "^0.28.0", + "axios": "0.21.4", "debug": "4.3.1", "openurl": "1.1.1", "yargs": "16.2.0" @@ -45600,7 +45591,8 @@ } }, "asynckit": { - "version": "0.4.0" + "version": "0.4.0", + "dev": true }, "at-least-node": { "version": "1.0.0", @@ -45672,25 +45664,11 @@ "dev": true }, "axios": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.28.1.tgz", - "integrity": "sha512-iUcGA5a7p0mVb4Gm/sy+FSECNkPFT4y7wt6OM/CDpO/OnNCvSs3PoMG8ibrC9jRoGYU0gUK5pXVC4NPXq6lHRQ==", + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", "requires": { - "follow-redirects": "1.15.6", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - }, - "dependencies": { - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - } + "follow-redirects": "1.15.6" } }, "axios-retry": { @@ -46950,6 +46928,7 @@ }, "combined-stream": { "version": "1.0.8", + "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -48091,7 +48070,8 @@ } }, "delayed-stream": { - "version": "1.0.0" + "version": "1.0.0", + "dev": true }, "depd": { "version": "2.0.0", @@ -53834,12 +53814,14 @@ "mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true }, "mime-types": { "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, "requires": { "mime-db": "1.52.0" } @@ -55775,7 +55757,8 @@ "proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true }, "psl": { "version": "1.8.0", diff --git a/package.json b/package.json index a4df16584..086d35a5e 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@types/react-transition-group": "^4.4.2", "@web3-storage/parse-link-header": "^3.1.0", "ajv": "^8.10.0", - "axios": "^0.28.0", + "axios": "^0.21.1", "axios-retry": "^3.1.9", "azure-iot-dtdl-parser": "^0.0.1-beta.0", "constantinople": "^4.0.1", @@ -176,8 +176,7 @@ "overrides": { "minimist@1.2.5": "1.2.6", "follow-redirects": "1.15.6", - "es5-ext": "0.10.63", - "axios": "^0.28.0" + "es5-ext": "0.10.63" }, "author": "", "license": "ISC" diff --git a/src/Adapters/ADTAdapter.ts b/src/Adapters/ADTAdapter.ts index b89f82fdf..49d49c244 100644 --- a/src/Adapters/ADTAdapter.ts +++ b/src/Adapters/ADTAdapter.ts @@ -583,9 +583,7 @@ export default class ADTAdapter implements IADTAdapter { return null; } }); - return new ADTModelsData( - (axiosResult?.data as unknown) as IADTModel[] - ); + return new ADTModelsData(axiosResult?.data); }); } @@ -817,7 +815,7 @@ export default class ADTAdapter implements IADTAdapter { const recursivelyAddToExpandedModels = async (modelId: string) => { try { // Add root model - const rootModel = (await fetchFullModel(modelId)).data.data + const rootModel = (await fetchFullModel(modelId)).data .model; expandedModels.push(rootModel); @@ -869,7 +867,7 @@ export default class ADTAdapter implements IADTAdapter { const parallelFetchModel = async (modelId: string) => { try { - const model = (await fetchFullModel(modelId)).data.data + const model = (await fetchFullModel(modelId)).data .model; expandedModels.push(model); } catch (err) { @@ -951,7 +949,7 @@ export default class ADTAdapter implements IADTAdapter { } }); - return new ADTRelationshipData(axiosResponse.data.data); + return new ADTRelationshipData(axiosResponse.data); }); } diff --git a/src/Adapters/ADXAdapter.ts b/src/Adapters/ADXAdapter.ts index 505d756c6..f9d4ead98 100644 --- a/src/Adapters/ADXAdapter.ts +++ b/src/Adapters/ADXAdapter.ts @@ -84,11 +84,8 @@ export default class ADXAdapter implements IADXAdapter { const adxDataHistoryResults = await getDataHistoryFromADX(); const resultTimeSeriesData: Array = []; // considering there is going to be multiple series to fetch data for - if ( - adxDataHistoryResults.data && - adxDataHistoryResults.data.data - ) { - const primaryResultTables: Array = adxDataHistoryResults.data.data.filter( + if (adxDataHistoryResults.data) { + const primaryResultTables: Array = adxDataHistoryResults.data.filter( (frame) => frame.TableKind === 'PrimaryResult' ); logDebugConsole( diff --git a/src/Adapters/BlobAdapter.ts b/src/Adapters/BlobAdapter.ts index eebd86279..f46bc0cd3 100644 --- a/src/Adapters/BlobAdapter.ts +++ b/src/Adapters/BlobAdapter.ts @@ -174,10 +174,8 @@ export default class BlobAdapter implements IBlobAdapter { ), headers: this.generateBlobHeaders(headers) }); - if (scenesBlob.data && scenesBlob.data.data) { - config = validate3DConfigWithSchema( - scenesBlob.data.data - ); + if (scenesBlob.data) { + config = validate3DConfigWithSchema(scenesBlob.data); } else { throw new Error('Data not found'); } @@ -278,7 +276,7 @@ export default class BlobAdapter implements IBlobAdapter { }); const filesXML = filesData.data; const parser = new XMLParser(); - let files: Array = parser.parse(filesXML.data) + let files: Array = parser.parse(filesXML) ?.EnumerationResults?.Blobs?.Blob; if (fileTypes) { files = files.filter((f) => From 347151ca06f583c9f337e1c02141a3a56e5bc073 Mon Sep 17 00:00:00 2001 From: Raj Potla Date: Fri, 2 Aug 2024 15:46:42 -0700 Subject: [PATCH 2/2] linting updates --- src/Adapters/ADTAdapter.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Adapters/ADTAdapter.ts b/src/Adapters/ADTAdapter.ts index 49d49c244..fc9a52515 100644 --- a/src/Adapters/ADTAdapter.ts +++ b/src/Adapters/ADTAdapter.ts @@ -867,8 +867,7 @@ export default class ADTAdapter implements IADTAdapter { const parallelFetchModel = async (modelId: string) => { try { - const model = (await fetchFullModel(modelId)).data - .model; + const model = (await fetchFullModel(modelId)).data.model; expandedModels.push(model); } catch (err) { adapterMethodSandbox.pushError({