diff --git a/README.md b/README.md index 425ed0d9e..a7da6e8b3 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,19 @@ + +This is the fork of [snowflake-connector-nodejs](https://github.com/snowflakedb/snowflake-connector-nodejs) +with the following changes: + +- Fixes https://github.com/snowflakedb/snowflake-connector-nodejs/issues/449 by moving non-mandatory dependencies to peerDependencies. So, folks who don't need e.g AWS SDK don't have to "download the whole internet". + +Published as [@naturalcycles/snowflake-sdk](https://www.npmjs.com/package/@naturalcycles/snowflake-sdk). + +## Readme + ******************************************************************************** NodeJS Driver for Snowflake ********************************************************************************
@@ -15,7 +25,7 @@ NodeJS Driver for Snowflake Install ====================================================================== -Run `npm i snowflake-sdk` in your existing NodeJs project. +Run `npm i @naturalcycles/snowflake-sdk` in your existing NodeJs project. Docs ====================================================================== diff --git a/index.d.ts b/index.d.ts index 0d4e17bea..a7d8cb7cf 100644 --- a/index.d.ts +++ b/index.d.ts @@ -6,7 +6,7 @@ * The snowflake-sdk module provides an instance to connect to the Snowflake server * @see [source] {@link https://docs.snowflake.com/en/developer-guide/node-js/nodejs-driver} */ -declare module 'snowflake-sdk' { +declare module '@naturalcycles/snowflake-sdk' { enum ErrorCode { // 400001 diff --git a/lib/file_transfer_agent/s3_util.js b/lib/file_transfer_agent/s3_util.js index 088d780b2..52da3e8a3 100644 --- a/lib/file_transfer_agent/s3_util.js +++ b/lib/file_transfer_agent/s3_util.js @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015-2024 Snowflake Computing Inc. All rights reserved. + * Copyright (c) 2015-2021 Snowflake Computing Inc. All rights reserved. */ -const { NodeHttpHandler } = require('@smithy/node-http-handler'); const EncryptionMetadata = require('./encrypt_util').EncryptionMetadata; const FileHeader = require('./file_util').FileHeader; const expandTilde = require('expand-tilde'); -const getProxyAgent = require('../http/node').getProxyAgent; const Util = require('../util'); const Logger = require('../logger'); const GlobalConfig = require('../global_config'); @@ -46,7 +44,6 @@ function S3Location(bucketName, s3path) { * @constructor */ function S3Util(connectionConfig, s3, filestream) { - const AWS = typeof s3 !== 'undefined' ? s3 : require('@aws-sdk/client-s3'); const fs = typeof filestream !== 'undefined' ? filestream : require('fs'); /** * Create an AWS S3 client using an AWS token. @@ -80,13 +77,16 @@ function S3Util(connectionConfig, s3, filestream) { } } if (proxy) { + const getProxyAgent = require('../http/node').getProxyAgent; const proxyAgent = getProxyAgent(proxy, new URL(connectionConfig.accessUrl), SNOWFLAKE_S3_DESTINATION); + const { NodeHttpHandler } = require('@smithy/node-http-handler'); config.requestHandler = new NodeHttpHandler({ httpAgent: proxyAgent, httpsAgent: proxyAgent }); } + const AWS = typeof s3 !== 'undefined' ? s3 : require('@aws-sdk/client-s3'); return new AWS.S3(config); }; diff --git a/package.json b/package.json index 436ced43d..50e2004bf 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,8 @@ { - "name": "snowflake-sdk", - "version": "1.15.0", + "name": "@naturalcycles/snowflake-sdk", + "version": "1.15.2", "description": "Node.js driver for Snowflake", "dependencies": { - "@aws-sdk/client-s3": "^3.388.0", - "@smithy/node-http-handler": "^3.2.5", - "@azure/storage-blob": "12.18.x", - "@google-cloud/storage": "^7.7.0", "@techteamer/ocsp": "1.0.1", "asn1.js-rfc2560": "^5.0.0", "asn1.js-rfc5280": "^3.0.0", @@ -15,7 +11,6 @@ "bignumber.js": "^9.1.2", "binascii": "0.0.2", "bn.js": "^5.2.1", - "browser-request": "^0.3.3", "expand-tilde": "^2.0.2", "fast-xml-parser": "^4.2.5", "fastest-levenshtein": "^1.0.16", @@ -37,6 +32,7 @@ "devDependencies": { "@aws-sdk/types": "^3.387.0", "async": "^3.2.3", + "browser-request": "^0.3.3", "check-dts": "^0.8.2", "eslint": "^8.41.0", "mocha": "^10.2.0", @@ -45,14 +41,31 @@ "test-console": "^2.0.0" }, "peerDependencies": { - "asn1.js": "^5.4.1" + "asn1.js": "^5.4.1", + "@aws-sdk/client-s3": "^3.388.0", + "@azure/storage-blob": "^12.11.0", + "@google-cloud/storage": "^7" }, - "overrides": { - "semver": "^7.5.2" + "peerDependenciesMeta": { + "asn1.js": { + "optional": true + }, + "@aws-sdk/client-s3": { + "optional": true + }, + "@azure/storage-blob": { + "optional": true + }, + "@google-cloud/storage": { + "optional": true + } }, "repository": { "type": "git", - "url": "https://github.com/snowflakedb/snowflake-connector-nodejs" + "url": "https://github.com/NaturalCycles/snowflake-connector-nodejs" + }, + "publishConfig": { + "access": "public" }, "typings": "./index.d.ts", "scripts": {