From 11497dd1b5b8858e78af758fab857fdd93330039 Mon Sep 17 00:00:00 2001 From: chulanovskyi Date: Fri, 8 Nov 2024 19:42:48 +0200 Subject: [PATCH] feat: used own requestHandler --- esbuild.package.js | 2 +- package-lock.json | 28 +++++++++++++++++-- package.json | 3 +- reverse_engineering/helpers/redshiftHelper.js | 18 ++++++++++-- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/esbuild.package.js b/esbuild.package.js index f1e9ac0..22e21ff 100644 --- a/esbuild.package.js +++ b/esbuild.package.js @@ -23,7 +23,7 @@ esbuild outdir: RELEASE_FOLDER_PATH, minify: true, logLevel: 'info', - external: ['lodash'], + external: ['lodash', 'electron'], plugins: [ clean({ patterns: [DEFAULT_RELEASE_FOLDER_PATH], diff --git a/package-lock.json b/package-lock.json index ab20585..8c26c92 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,17 @@ { "name": "Redshift", - "version": "0.2.10", + "version": "0.2.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "Redshift", - "version": "0.2.10", + "version": "0.2.11", "dependencies": { "@aws-sdk/client-redshift": "3.679.0", "@aws-sdk/client-redshift-data": "3.679.0", "@aws-sdk/client-redshift-serverless": "3.679.0", + "@hackolade/fetch": "1.1.0", "lodash": "4.17.21" }, "devDependencies": { @@ -1209,6 +1210,29 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@hackolade/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@hackolade/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-P6VoXDh5yAjwC7oVKqhkxMs53Qv07CVJLw69wsRgJkKvpBpkKpDRZM3dQ4uExtwwsrxGk3b4gxANUb7IHFffDQ==", + "dependencies": { + "@smithy/fetch-http-handler": "4.0.0", + "@smithy/protocol-http": "4.1.5", + "@smithy/querystring-builder": "3.0.8", + "@smithy/types": "3.6.0" + } + }, + "node_modules/@hackolade/fetch/node_modules/@smithy/fetch-http-handler": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-4.0.0.tgz", + "integrity": "sha512-MLb1f5tbBO2X6K4lMEKJvxeLooyg7guq48C2zKr4qM7F2Gpkz4dc+hdSgu77pCJ76jVqFBjZczHYAs6dp15N+g==", + "dependencies": { + "@smithy/protocol-http": "^4.1.5", + "@smithy/querystring-builder": "^3.0.8", + "@smithy/types": "^3.6.0", + "@smithy/util-base64": "^3.0.0", + "tslib": "^2.6.2" + } + }, "node_modules/@hackolade/hck-esbuild-plugins-pack": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/@hackolade/hck-esbuild-plugins-pack/-/hck-esbuild-plugins-pack-0.0.1.tgz", diff --git a/package.json b/package.json index 1f6e6f1..59236a8 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ "@aws-sdk/client-redshift": "3.679.0", "@aws-sdk/client-redshift-data": "3.679.0", "@aws-sdk/client-redshift-serverless": "3.679.0", + "@hackolade/fetch": "1.1.0", "lodash": "4.17.21" }, "lint-staged": { @@ -103,4 +104,4 @@ "prettier": "3.2.5", "simple-git-hooks": "2.11.1" } -} \ No newline at end of file +} diff --git a/reverse_engineering/helpers/redshiftHelper.js b/reverse_engineering/helpers/redshiftHelper.js index 5e633e2..2b4a8b4 100644 --- a/reverse_engineering/helpers/redshiftHelper.js +++ b/reverse_engineering/helpers/redshiftHelper.js @@ -5,6 +5,7 @@ const redshiftClient = require('@aws-sdk/client-redshift'); const redshiftData = require('@aws-sdk/client-redshift-data'); const redshiftLess = require('@aws-sdk/client-redshift-serverless'); const ddlViewCreationHelper = require('./ddlViewCreationHelper'); +const { hckFetchAwsSdkHttpHandler } = require('@hackolade/fetch'); const noConnectionError = { message: 'Connection error' }; @@ -36,15 +37,26 @@ const getParamsForConnect = connectionInfo => { const connect = async (connectionInfo, logger) => { helperLogger = logger; - const { clusterIdentifier, databaseName, workgroupName, instanceType = 'Cluster' } = connectionInfo; + const { + clusterIdentifier, + databaseName, + workgroupName, + instanceType = 'Cluster', + queryRequestTimeout, + } = connectionInfo; const params = getParamsForConnect(connectionInfo); - const redshiftDataInstance = new redshiftData.RedshiftData({ apiVersion: '2019-12-20', ...params }); + const requestHandler = hckFetchAwsSdkHttpHandler({ requestTimeout: queryRequestTimeout }); + const redshiftDataInstance = new redshiftData.RedshiftData({ + apiVersion: '2019-12-20', + ...params, + requestHandler, + }); if (instanceType === 'Cluster') { redshift = await setCluster(params, clusterIdentifier, databaseName); } else if (instanceType === 'ServerLess') { redshift = await setServerLess(params, workgroupName, databaseName); } - redshift = { ...redshift, redshiftDataInstance, instanceType }; + redshift = { ...redshift, redshiftDataInstance, instanceType, requestHandler }; }; const setCluster = async (params, clusterIdentifier, databaseName) => {