From 475c7bbe57c5f74158143a03298f174373eecc84 Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Tue, 26 Dec 2023 20:06:55 +0100 Subject: [PATCH 1/5] fix: move non-mandatory deps to peerDependencies fixes https://github.com/snowflakedb/snowflake-connector-nodejs/issues/449 --- README.md | 14 ++++++++++++-- lib/file_transfer_agent/s3_util.js | 2 +- package.json | 31 +++++++++++++++++++++++------- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 017cf99b9..2e9510729 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 ********************************************************************************

master - npm + npm apache codecov

@@ -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/lib/file_transfer_agent/s3_util.js b/lib/file_transfer_agent/s3_util.js index 522821125..527e51ddf 100644 --- a/lib/file_transfer_agent/s3_util.js +++ b/lib/file_transfer_agent/s3_util.js @@ -38,7 +38,6 @@ function S3Location(bucketName, s3path) { * @constructor */ function S3Util(s3, filestream) { - const AWS = typeof s3 !== 'undefined' ? s3 : require('@aws-sdk/client-s3'); const fs = typeof filestream !== 'undefined' ? filestream : require('fs'); // magic number, given from error message. @@ -73,6 +72,7 @@ function S3Util(s3, filestream) { useAccelerateEndpoint: useAccelerateEndpoint, }; + 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 210c0bcc0..788099231 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,8 @@ { - "name": "snowflake-sdk", - "version": "1.9.2", + "name": "@naturalcycles/snowflake-sdk", + "version": "1.9.4", "description": "Node.js driver for Snowflake", "dependencies": { - "@aws-sdk/client-s3": "^3.388.0", - "@azure/storage-blob": "^12.11.0", - "@google-cloud/storage": "^6.9.3", "@techteamer/ocsp": "1.0.1", "agent-base": "^6.0.2", "asn1.js-rfc2560": "^5.0.0", @@ -46,14 +43,34 @@ "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": "^6.9.3" + }, + "peerDependenciesMeta": { + "asn1.js": { + "optional": true + }, + "@aws-sdk/client-s3": { + "optional": true + }, + "@azure/storage-blob": { + "optional": true + }, + "@google-cloud/storage": { + "optional": true + } }, "overrides": { "semver": "^7.5.2" }, "repository": { "type": "git", - "url": "https://github.com/snowflakedb/snowflake-connector-nodejs" + "url": "https://github.com/NaturalCycles/snowflake-connector-nodejs" + }, + "publishConfig": { + "access": "public" }, "scripts": { "lint:check": "eslint", From 4c0a781c9bf18b5bed20cd83e3cbc9f2dafc2a85 Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Wed, 27 Dec 2023 18:28:38 +0100 Subject: [PATCH 2/5] fix: remove more unused dependencies --- package.json | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 788099231..3a03a5962 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,9 @@ { "name": "@naturalcycles/snowflake-sdk", - "version": "1.9.4", + "version": "1.9.5", "description": "Node.js driver for Snowflake", "dependencies": { "@techteamer/ocsp": "1.0.1", - "agent-base": "^6.0.2", "asn1.js-rfc2560": "^5.0.0", "asn1.js-rfc5280": "^3.0.0", "axios": "^1.6.0", @@ -12,10 +11,7 @@ "bignumber.js": "^9.1.2", "binascii": "0.0.2", "bn.js": "^5.2.1", - "browser-request": "^0.3.3", - "debug": "^3.2.6", "expand-tilde": "^2.0.2", - "extend": "^3.0.2", "fast-xml-parser": "^4.2.5", "fastest-levenshtein": "^1.0.16", "generic-pool": "^3.8.2", @@ -36,6 +32,7 @@ "devDependencies": { "@aws-sdk/types": "^3.387.0", "async": "^3.2.3", + "browser-request": "^0.3.3", "eslint": "^8.41.0", "mocha": "^10.2.0", "mock-require": "^3.0.3", @@ -62,9 +59,6 @@ "optional": true } }, - "overrides": { - "semver": "^7.5.2" - }, "repository": { "type": "git", "url": "https://github.com/NaturalCycles/snowflake-connector-nodejs" From 3ef508ea1fb4a48877dc465d6cde0f8912fa89e7 Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Fri, 31 May 2024 17:25:29 +0200 Subject: [PATCH 3/5] fix: types --- index.d.ts | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index 7d494f730..f60e24196 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' { export const enum RowMode { ARRAY = 'array', OBJECT = 'object', @@ -491,7 +491,7 @@ declare module 'snowflake-sdk' { export interface StatementOption { sqlText: string; - complete: StatementCallback; + complete?: StatementCallback; /** * The requestId is for resubmitting requests. @@ -791,4 +791,4 @@ declare module 'snowflake-sdk' { * Creates a connection pool for Snowflake connections. */ export function createPool(options: ConnectionOptions, poolOptions?: PoolOptions): Pool; -} \ No newline at end of file +} diff --git a/package.json b/package.json index dd13f018e..c09009cb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@naturalcycles/snowflake-sdk", - "version": "1.11.0", + "version": "1.11.1", "description": "Node.js driver for Snowflake", "dependencies": { "@techteamer/ocsp": "1.0.1", From 960f9e3dab140753f3272b2905a564a4b49f3039 Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Thu, 14 Nov 2024 21:29:03 +0100 Subject: [PATCH 4/5] fix: index.d.ts module name --- index.d.ts | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/package.json b/package.json index 44ba3ff6f..723a41e32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@naturalcycles/snowflake-sdk", - "version": "1.15.0", + "version": "1.15.1", "description": "Node.js driver for Snowflake", "dependencies": { "@techteamer/ocsp": "1.0.1", From c9a1af69714d5c8b618d14b620d43266d9f999fe Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Sun, 8 Jun 2025 09:45:01 +0200 Subject: [PATCH 5/5] fix: bump `@google-cloud/storage` peerDep to 7 to avoid peerDependency warning --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 723a41e32..50e2004bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@naturalcycles/snowflake-sdk", - "version": "1.15.1", + "version": "1.15.2", "description": "Node.js driver for Snowflake", "dependencies": { "@techteamer/ocsp": "1.0.1", @@ -44,7 +44,7 @@ "asn1.js": "^5.4.1", "@aws-sdk/client-s3": "^3.388.0", "@azure/storage-blob": "^12.11.0", - "@google-cloud/storage": "^6.9.3" + "@google-cloud/storage": "^7" }, "peerDependenciesMeta": { "asn1.js": {