Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
********************************************************************************
<p>
<a href="https://github.com/snowflakedb/snowflake-connector-nodejs/actions?query=workflow%3A%22Build+and+Test%22+branch%3Amaster" target="_blank"><img src="https://github.com/snowflakedb/snowflake-connector-nodejs/workflows/Build%20and%20Test/badge.svg?branch=master" alt="master" /></a>
<a href="https://www.npmjs.com/package/snowflake-sdk" target="_blank"><img src="https://img.shields.io/npm/v/snowflake-sdk.svg" alt="npm" /></a>
<a href="https://www.npmjs.com/package/@naturalcycles/snowflake-sdk" target="_blank"><img src="https://img.shields.io/npm/v/@naturalcycles/snowflake-sdk.svg" alt="npm" /></a>
<a href="http://www.apache.org/licenses/LICENSE-2.0.txt" target="_blank"><img src="http://img.shields.io/:license-Apache%202-brightgreen.svg" alt="apache" /> </a>
<a href="https://codecov.io/gh/snowflakedb/snowflake-connector-nodejs" target="_blank"><img src="https://codecov.io/gh/snowflakedb/snowflake-connector-nodejs/branch/master/graph/badge.svg?token=QZMWDu35ds" alt="codecov" /></a>
</p>
Expand All @@ -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
======================================================================
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/file_transfer_agent/s3_util.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
};

Expand Down
35 changes: 24 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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": {
Expand Down