Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

snowflake-sdk

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snowflake-sdk - npm Package Compare versions

Comparing version 1.1.11 to 1.1.12

2

index.js
/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/
module.exports = require('./lib/snowflake');
/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -196,2 +196,19 @@

}
// check for invalid clientSessionKeepAlive
var clientSessionKeepAlive = options.clientSessionKeepAlive;
if (Util.exists(clientSessionKeepAlive))
{
Errors.checkArgumentValid(Util.isBoolean(clientSessionKeepAlive),
ErrorCodes.ERR_CONN_CREATE_INVALID_KEEP_ALIVE);
}
// check for invalid clientSessionKeepAliveHeartbeatFrequency
var clientSessionKeepAliveHeartbeatFrequency = options.clientSessionKeepAliveHeartbeatFrequency;
if (Util.exists(clientSessionKeepAliveHeartbeatFrequency))
{
Errors.checkArgumentValid(Util.isNumber(clientSessionKeepAliveHeartbeatFrequency),
ErrorCodes.ERR_CONN_CREATE_INVALID_KEEP_ALIVE_HEARTBEAT_FREQ);
clientSessionKeepAliveHeartbeatFrequency = Util.validateClientSessionKeepAliveHeartbeatFrequency(clientSessionKeepAliveHeartbeatFrequency, 14400);
}

@@ -320,2 +337,22 @@ // remember if we're in qa mode

/**
* Returns the client session keep alive setting.
*
* @returns {String}
*/
this.getClientSessionKeepAlive = function()
{
return clientSessionKeepAlive;
};
/**
* Returns the client session keep alive heartbeat frequency setting.
*
* @returns {String}
*/
this.getClientSessionKeepAliveHeartbeatFrequency = function()
{
return clientSessionKeepAliveHeartbeatFrequency;
};
// save config options

@@ -322,0 +359,0 @@ this.username = options.username;

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -11,2 +11,3 @@ const uuidv4 = require('uuid/v4');

var Statement = require('./statement');
var Parameters = require('../parameters');

@@ -31,2 +32,4 @@ /**

var keepalive = null;
/**

@@ -42,2 +45,17 @@ * Returns true if the connection is active otherwise false

this.getServiceName = function()
{
return services.sf.getServiceName();
};
this.getClientSessionKeepAlive = function()
{
return services.sf.getClientSessionKeepAlive();
};
this.getClientSessionKeepAliveHeartbeatFrequency = function()
{
return services.sf.getClientSessionKeepAliveHeartbeatFrequency();
};
/**

@@ -53,2 +71,11 @@ * Returns the connection id.

this.heartbeat = function(self)
{
self.execute({
sqlText: 'select /* nodejs:heartbeat */ 1;',
complete: function () {},
internal: true,
});
};
/**

@@ -77,2 +104,7 @@ * Establishes a connection if we aren't in a fatal state.

{
if (Parameters.getValue(Parameters.names.CLIENT_SESSION_KEEP_ALIVE))
{
keepalive = setInterval(self.heartbeat, Parameters.getValue(Parameters.names.CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY) * 1000, self);
}
if (Util.isFunction(callback))

@@ -138,2 +170,7 @@ {

{
if (Util.exists(self.keepalive))
{
clearInterval(self.keepalive);
}
if (Util.isFunction(callback))

@@ -140,0 +177,0 @@ {

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -45,2 +45,4 @@

exports[404022] = 'Invalid region. The specified value must be a string.';
exports[404023] = 'Invalid clientSessionKeepAlive. The specified value must be a boolean.';
exports[404024] = 'Invalid clientSessionKeepAliveHeartbeatFrequency. The specified value must be a number.';

@@ -47,0 +49,0 @@ // 405001

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -50,2 +50,4 @@

codes.ERR_CONN_CREATE_INVALID_REGION = 404022;
codes.ERR_CONN_CREATE_INVALID_KEEP_ALIVE = 404023;
codes.ERR_CONN_CREATE_INVALID_KEEP_ALIVE_HEARTBEAT_FREQ = 404024;

@@ -52,0 +54,0 @@ // 405001

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@ const uuidv4 = require('uuid/v4');

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/
var Util = require('./util');
var Util = require('./util');
var Errors = require('./errors');

@@ -29,3 +29,3 @@

*/
this.getName = function()
this.getName = function ()
{

@@ -40,3 +40,3 @@ return name;

*/
this.getValue = function()
this.getValue = function ()
{

@@ -51,3 +51,3 @@ return value;

*/
this.setValue = function(targetValue)
this.setValue = function (targetValue)
{

@@ -60,13 +60,34 @@ value = targetValue;

names.JS_DRIVER_DISABLE_OCSP_FOR_NON_SF_ENDPOINTS = 'JS_DRIVER_DISABLE_OCSP_FOR_NON_SF_ENDPOINTS';
names.SERVICE_NAME = 'SERVICE_NAME';
names.CLIENT_SESSION_KEEP_ALIVE = 'CLIENT_SESSION_KEEP_ALIVE';
names.CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY = 'CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY';
var parameters =
[
new Parameter(
{
name : names.JS_DRIVER_DISABLE_OCSP_FOR_NON_SF_ENDPOINTS,
value : false,
desc : 'Whether to disable OCSP validation in the JavaScript driver ' +
'when communicating with non-Snowflake endpoints (e.g. S3/Blob).'
})
];
[
new Parameter(
{
name: names.JS_DRIVER_DISABLE_OCSP_FOR_NON_SF_ENDPOINTS,
value: false,
desc: 'Whether to disable OCSP validation in the JavaScript driver ' +
'when communicating with non-Snowflake endpoints (e.g. S3/Blob).'
}),
new Parameter(
{
name: names.SERVICE_NAME,
value: '',
desc: 'Hint for load balancer.'
}),
new Parameter(
{
name: names.CLIENT_SESSION_KEEP_ALIVE,
value: false,
desc: 'When true, enables the driver to keep the session alive indefinitely'
}),
new Parameter(
{
name: names.CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY,
value: 3600,
desc: 'The amount of time in seconds that a heartbeat will be sent to the server'
}),
];

@@ -88,3 +109,3 @@ // put all the parameters in a map so they're easy to retrieve and update

*/
exports.getValue = function(parameterName)
exports.getValue = function (parameterName)
{

@@ -96,3 +117,3 @@ // resolve the parameter name

Errors.assertInternal(
Util.exists(parameter), 'invalid parameter name: ' + parameterName);
Util.exists(parameter), 'invalid parameter name: ' + parameterName);

@@ -107,3 +128,3 @@ return parameter.getValue();

*/
exports.update = function(parametersConfig)
exports.update = function (parametersConfig)
{

@@ -110,0 +131,0 @@ // if an input is specified

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -446,2 +446,17 @@

this.getServiceName = function()
{
return Parameters.getValue(Parameters.names.SERVICE_NAME);
};
this.getClientSessionKeepAlive = function()
{
return Parameters.getValue(Parameters.names.CLIENT_SESSION_KEEP_ALIVE);
};
this.getClientSessionKeepAliveHeartbeatFrequency = function()
{
return Parameters.getValue(Parameters.names.CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY);
};
// if we don't have any tokens, start out as pristine

@@ -653,2 +668,8 @@ if (tokenInfo.isEmpty())

'Snowflake Token="' + options.tokenInfo.getSessionToken() + '"';
if (Util.string.isNotNullOrEmpty(
Parameters.getValue(Parameters.names.SERVICE_NAME)))
{
requestOptions.headers['X-Snowflake-Service'] =
Parameters.getValue(Parameters.names.SERVICE_NAME);
}
};

@@ -926,3 +947,20 @@

var sessionParameters =
{
SESSION_PARAMETERS : {}
};
if (Util.exists(this.connectionConfig.getClientSessionKeepAlive()))
{
sessionParameters.SESSION_PARAMETERS.CLIENT_SESSION_KEEP_ALIVE = this.connectionConfig.getClientSessionKeepAlive();
}
if (Util.exists(this.connectionConfig.getClientSessionKeepAliveHeartbeatFrequency()))
{
sessionParameters.SESSION_PARAMETERS.CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY =
this.connectionConfig.getClientSessionKeepAliveHeartbeatFrequency();
}
Util.apply(json.data, clientInfo);
Util.apply(json.data, sessionParameters);

@@ -929,0 +967,0 @@ // issue a login request

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/

@@ -4,0 +4,0 @@

/*
* Copyright (c) 2015-2018 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*

@@ -413,1 +413,18 @@ */

exports.validateClientSessionKeepAliveHeartbeatFrequency = function (input, masterValidity)
{
var heartbeatFrequency = input;
var realMax = Math.floor(masterValidity / 4);
var realMin = Math.floor(realMax / 4);
if (input > realMax)
{
heartbeatFrequency = realMax;
}
else if (input < realMin)
{
heartbeatFrequency = realMin;
}
heartbeatFrequency = Math.floor(heartbeatFrequency);
return heartbeatFrequency;
};

@@ -190,3 +190,3 @@

Copyright (c) 2013-2018 Snowflake Computing, Inc.
Copyright (c) 2013-2019 Snowflake Computing, Inc.

@@ -193,0 +193,0 @@ Licensed under the Apache License, Version 2.0 (the "License");

{
"name": "snowflake-sdk",
"version": "1.1.11",
"version": "1.1.12",
"description": "Node.js driver for Snowflake",

@@ -5,0 +5,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc