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

tedious

Package Overview
Dependencies
Maintainers
1
Versions
227
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tedious - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

site/api-connection.html

3

lib/all-headers.js

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var TXNDESCRIPTOR_HEADER_DATA_LEN, TXNDESCRIPTOR_HEADER_LEN, TYPE, WritableTrackingBuffer;

@@ -18,2 +18,3 @@

var data;
buffer.writeUInt32LE(0);

@@ -20,0 +21,0 @@ buffer.writeUInt32LE(TXNDESCRIPTOR_HEADER_LEN);

@@ -1,6 +0,6 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
if (!Buffer.concat) {
Buffer.concat = function(buffers) {
var buffer, length, position, result, _i, _j, _len, _len1;
length = 0;

@@ -28,2 +28,3 @@ for (_i = 0, _len = buffers.length; _i < _len; _i++) {

var b, index, _i, _len;
if (this.length !== other.length) {

@@ -30,0 +31,0 @@ return false;

@@ -1,3 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
exports.codepageByLcid = {

@@ -4,0 +3,0 @@ 1025: 'WINDOWS-1256',

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var Connection, DEFAULT_CANCEL_TIMEOUT, DEFAULT_CLIENT_REQUEST_TIMEOUT, DEFAULT_CONNECT_TIMEOUT, DEFAULT_PACKET_SIZE, DEFAULT_PORT, DEFAULT_TDS_VERSION, DEFAULT_TEXTSIZE, Debug, EventEmitter, ISOLATION_LEVEL, KEEP_ALIVE_INITIAL_DELAY, Login7Payload, MessageIO, PreloginPayload, Request, RpcRequestPayload, Socket, SqlBatchPayload, TYPE, TokenStreamParser, Transaction, crypto, instanceLookup, tls,

@@ -59,3 +59,2 @@ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

Connection = (function(_super) {
__extends(Connection, _super);

@@ -106,2 +105,3 @@

this.initiateTlsSslHandshake();
this.sendLogin7Packet();
return this.transitionTo(this.STATE.SENT_TLSSSLNEGOTIATION);

@@ -125,3 +125,2 @@ }

tlsNegotiated: function() {
this.encryptAllFutureTraffic();
return this.tlsNegotiationComplete = true;

@@ -131,3 +130,2 @@ },

if (this.tlsNegotiationComplete) {
this.sendLogin7Packet();
return this.transitionTo(this.STATE.SENT_LOGIN7_WITH_STANDARD_LOGIN);

@@ -169,2 +167,5 @@ } else {

events: {
connectTimeout: function() {
return this.transitionTo(this.STATE.FINAL);
},
data: function(data) {

@@ -198,6 +199,7 @@ return this.sendDataToTokenStreamParser(data);

var sqlRequest;
this.transitionTo(this.STATE.LOGGED_IN);
sqlRequest = this.request;
this.request = void 0;
return sqlRequest.callback(sqlRequest.error, sqlRequest.rowCount);
return sqlRequest.callback(sqlRequest.error, sqlRequest.rowCount, sqlRequest.rows);
}

@@ -213,3 +215,5 @@ }

loginFailed: function() {},
connectTimeout: function() {}
connectTimeout: function() {},
message: function() {},
socketError: function() {}
}

@@ -221,10 +225,7 @@ }

this.config = config;
this.reset = __bind(this.reset, this);
this.socketClose = __bind(this.socketClose, this);
this.socketConnect = __bind(this.socketConnect, this);
this.socketError = __bind(this.socketError, this);
this.connectTimeout = __bind(this.connectTimeout, this);
this.defaultConfig();

@@ -258,2 +259,3 @@ this.createDebug();

var _base, _base1, _base2, _base3, _base4, _base5, _base6, _base7, _base8, _base9;
(_base = this.config).options || (_base.options = {});

@@ -278,2 +280,3 @@ (_base1 = this.config.options).textsize || (_base1.textsize = DEFAULT_TEXTSIZE);

var _this = this;
this.debug = new Debug(this.config.options.debug);

@@ -287,2 +290,3 @@ return this.debug.on('debug', function(message) {

var _this = this;
this.tokenStreamParser = new TokenStreamParser(this.debug, void 0, this.config.options.tdsVersion);

@@ -338,3 +342,5 @@ this.tokenStreamParser.on('infoMessage', function(token) {

if (_this.request) {
_this.request.rowCount++;
if (_this.config.options.rowCollectionOnRequestCompletion || _this.config.options.rowCollectionOnDone) {
_this.request.rows.push(token.columns);
}
return _this.request.emit('row', token.columns);

@@ -357,4 +363,10 @@ } else {

if (_this.request) {
_this.request.emit('doneProc', token.rowCount, token.more, _this.procReturnStatusValue);
return _this.procReturnStatusValue = void 0;
_this.request.emit('doneProc', token.rowCount, token.more, _this.procReturnStatusValue, _this.request.rows);
_this.procReturnStatusValue = void 0;
if (token.rowCount !== void 0) {
_this.request.rowCount += token.rowCount;
}
if (_this.config.options.rowCollectionOnDone) {
return _this.request.rows = [];
}
}

@@ -364,10 +376,25 @@ });

if (_this.request) {
return _this.request.emit('doneInProc', token.rowCount, token.more);
_this.request.emit('doneInProc', token.rowCount, token.more, _this.request.rows);
if (token.rowCount !== void 0) {
_this.request.rowCount += token.rowCount;
}
if (_this.config.options.rowCollectionOnDone) {
return _this.request.rows = [];
}
}
});
return this.tokenStreamParser.on('done', function(token) {
this.tokenStreamParser.on('done', function(token) {
if (_this.request) {
return _this.request.emit('done', token.rowCount, token.more);
_this.request.emit('done', token.rowCount, token.more, _this.request.rows);
if (token.rowCount !== void 0) {
_this.request.rowCount += token.rowCount;
}
if (_this.config.options.rowCollectionOnDone) {
return _this.request.rows = [];
}
}
});
return this.tokenStreamParser.on('resetConnection', function(token) {
return _this.emit('resetConnection');
});
};

@@ -377,2 +404,3 @@

var _this = this;
if (this.config.options.port) {

@@ -393,2 +421,3 @@ return this.connectOnPort(this.config.options.port);

var _this = this;
this.socket = new Socket({});

@@ -420,2 +449,3 @@ this.socket.setKeepAlive(true, KEEP_ALIVE_INITIAL_DELAY);

var message;
message = "timeout : failed to connect to " + this.config.server + ":" + this.config.options.port + " in " + this.config.options.connectTimeout + "ms";

@@ -436,2 +466,3 @@ this.debug.log(message);

var _ref, _ref1;
if ((_ref = this.state) != null ? _ref.exit : void 0) {

@@ -449,2 +480,3 @@ this.state.exit.apply(this);

var args, eventFunction, eventName, _ref;
eventName = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];

@@ -460,2 +492,3 @@ if ((_ref = this.state) != null ? _ref.events[eventName] : void 0) {

var message;
message = "connection to " + this.config.server + ":" + this.config.options.port + " - failed " + error;

@@ -478,2 +511,3 @@ this.debug.log(message);

var payload;
payload = new PreloginPayload({

@@ -498,2 +532,3 @@ encrypt: this.config.options.encrypt

var preloginPayload;
preloginPayload = new PreloginPayload(this.messageBuffer);

@@ -512,2 +547,3 @@ this.debug.payload(function() {

var loginData, payload;
loginData = {

@@ -517,2 +553,3 @@ userName: this.config.userName,

database: this.config.options.database,
appName: this.config.options.appName,
packetSize: this.config.options.packetSize,

@@ -529,4 +566,6 @@ tdsVersion: this.config.options.tdsVersion

Connection.prototype.initiateTlsSslHandshake = function() {
var credentials,
var credentials, _base,
_this = this;
(_base = this.config.options.cryptoCredentialsDetails).ciphers || (_base.ciphers = 'RC4-MD5');
credentials = crypto.createCredentials(this.config.options.cryptoCredentialsDetails);

@@ -536,17 +575,15 @@ this.securePair = tls.createSecurePair(credentials);

var cipher;
cipher = _this.securePair.cleartext.getCipher();
_this.debug.log("TLS negotiated (" + cipher.name + ", " + cipher.version + ")");
_this.emit('secure', _this.securePair.cleartext);
_this.messageIo.encryptAllFutureTraffic();
return _this.dispatchEvent('tlsNegotiated');
});
return this.securePair.encrypted.on('data', function(data) {
this.securePair.encrypted.on('data', function(data) {
return _this.messageIo.sendMessage(TYPE.PRELOGIN, data);
});
return this.messageIo.tlsNegotiationStarting(this.securePair);
};
Connection.prototype.encryptAllFutureTraffic = function() {
this.securePair.encrypted.removeAllListeners();
return this.messageIo.encryptAllFutureTraffic(this.securePair);
};
Connection.prototype.sendDataToTokenStreamParser = function(data) {

@@ -558,6 +595,11 @@ return this.tokenStreamParser.addBuffer(data);

var payload;
payload = new SqlBatchPayload('set textsize ' + this.config.options.textsize, this.currentTransactionDescriptor());
payload = new SqlBatchPayload(this.getInitialSql(), this.currentTransactionDescriptor());
return this.messageIo.sendMessage(TYPE.SQL_BATCH, payload.data);
};
Connection.prototype.getInitialSql = function() {
return 'set textsize ' + this.config.options.textsize + 'set quoted_identifier on\nset arithabort off\nset numeric_roundabort off\nset ansi_warnings on\nset ansi_padding on\nset ansi_nulls on\nset concat_null_yields_null on\nset cursor_close_on_commit off\nset implicit_transactions off\nset language us_english\nset dateformat mdy\nset datefirst 7\nset transaction isolation level read committed';
};
Connection.prototype.processedInitialSql = function() {

@@ -608,2 +650,3 @@ this.clearConnectTimer();

_this = this;
name || (name = '');

@@ -621,2 +664,3 @@ isolationLevel || (isolationLevel = this.config.options.isolationLevel);

var request, transaction;
if (this.transactions.length === 0) {

@@ -632,2 +676,3 @@ throw new Error('No transaction in progress');

var request, transaction;
if (this.transactions.length === 0) {

@@ -643,2 +688,3 @@ throw new Error('No transaction in progress');

var message;
if (this.state !== this.STATE.LOGGED_IN) {

@@ -651,3 +697,5 @@ message = "Invalid state; requests can only be made in the " + this.STATE.LOGGED_IN.name + " state, not the " + this.state.name + " state";

this.request.rowCount = 0;
this.messageIo.sendMessage(packetType, payload.data);
this.request.rows = [];
this.messageIo.sendMessage(packetType, payload.data, this.resetConnectionOnNextRequest);
this.resetConnectionOnNextRequest = false;
this.debug.payload(function() {

@@ -660,2 +708,12 @@ return payload.toString(' ');

Connection.prototype.reset = function(callback) {
var request;
request = new Request(this.getInitialSql(), function(err, rowCount, rows) {
return callback(err);
});
this.resetConnectionOnNextRequest = true;
return this.execSqlBatch(request);
};
Connection.prototype.currentTransactionDescriptor = function() {

@@ -662,0 +720,0 @@ return this.transactionDescriptors[this.transactionDescriptors.length - 1];

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var EPOCH_DATE, MAX, NULL, TYPE, guidParser, id, type, typeByName;

@@ -93,2 +93,3 @@

var days, minutes;
buffer.writeUInt8(typeByName.DateTimeN.id);

@@ -110,22 +111,16 @@ buffer.writeUInt8(4);

type: 'FLT4',
name: 'Real'
/*
declaration: (parameter) ->
'real'
writeParameterData: (buffer, parameter) ->
# ParamMetaData (TYPE_INFO)
# Some issues with rounding
buffer.writeUInt8(typeByName.FloatN.id)
buffer.writeUInt8(4)
# ParamLenData
if parameter.value?
buffer.writeUInt8(4)
buffer.writeFloatLE(parseFloat(parameter.value))
else
buffer.writeUInt8(0)
*/
name: 'Real',
declaration: function(parameter) {
return 'real';
},
writeParameterData: function(buffer, parameter) {
buffer.writeUInt8(typeByName.FloatN.id);
buffer.writeUInt8(4);
if (parameter.value != null) {
buffer.writeUInt8(4);
return buffer.writeFloatLE(parseFloat(parameter.value));
} else {
return buffer.writeUInt8(0);
}
}
},

@@ -144,2 +139,3 @@ 0x3C: {

var days, milliseconds, seconds, threeHundredthsOfSecond;
buffer.writeUInt8(typeByName.DateTimeN.id);

@@ -226,2 +222,3 @@ buffer.writeUInt8(8);

var length;
if (parameter.length) {

@@ -323,2 +320,3 @@ length = parameter.length;

var length;
if (parameter.length) {

@@ -339,2 +337,3 @@ length = parameter.length;

var length;
if (parameter.length) {

@@ -388,2 +387,3 @@ length = parameter.length;

var length;
if (parameter.length) {

@@ -404,2 +404,3 @@ length = 2 * parameter.length;

var length;
if (parameter.length) {

@@ -406,0 +407,0 @@ length = 2 * parameter.length;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var Debug, EventEmitter, util,

@@ -11,9 +11,8 @@ __hasProp = {}.hasOwnProperty,

Debug = (function(_super) {
__extends(Debug, _super);
/*
@options Which debug details should be sent.
data - dump of packet data
payload - details of decoded payload
@options Which debug details should be sent.
data - dump of packet data
payload - details of decoded payload
*/

@@ -20,0 +19,0 @@

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var arrayToGuid, formatHex, guidToArray;

@@ -6,2 +6,3 @@

var b1, b10, b11, b12, b13, b14, b15, b16, b2, b3, b4, b5, b6, b7, b8, b9, final;
b1 = parseInt(guid.substring(6, 8), 16);

@@ -31,2 +32,3 @@ b2 = parseInt(guid.substring(4, 6), 16);

var hex;
hex = number.toString(16);

@@ -41,2 +43,3 @@ if (hex.length === 1) {

var guid;
guid = formatHex(array[3]) + formatHex(array[2]) + formatHex(array[1]) + formatHex(array[0]) + '-' + formatHex(array[5]) + formatHex(array[4]) + '-' + formatHex(array[7]) + formatHex(array[6]) + '-' + formatHex(array[8]) + formatHex(array[9]) + '-' + formatHex(array[10]) + formatHex(array[11]) + formatHex(array[12]) + formatHex(array[13]) + formatHex(array[14]) + formatHex(array[15]);

@@ -43,0 +46,0 @@ return guid.toUpperCase();

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var MYSTERY_HEADER_LENGTH, RETRIES, SQL_SERVER_BROWSER_PORT, TIMEOUT, dgram, parseBrowserResponse;

@@ -16,2 +16,3 @@

var error, makeAttempt, message, retriesLeft, socket, timedOut, timer;
timeout = timeout || TIMEOUT;

@@ -23,2 +24,3 @@ retriesLeft = retries || RETRIES;

var port;
if (timer) {

@@ -52,2 +54,3 @@ clearTimeout(timer);

var request;
if (retriesLeft > 0) {

@@ -70,2 +73,3 @@ retriesLeft--;

var getPort, instance, instances, name, p, parts, port, value, _i, _j, _len, _ref;
instances = response.split(';;');

@@ -72,0 +76,0 @@ for (_i = 0, _len = instances.length; _i < _len; _i++) {

@@ -1,3 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
exports.name = 'Tedious';

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var FLAGS_1, FLAGS_2, FLAGS_3, Login7Payload, TYPE_FLAGS, WritableTrackingBuffer, libraryName, os, sprintf, versions;

@@ -71,5 +71,5 @@

Login7Payload = (function() {
function Login7Payload(loginData) {
var data, fixed, length, lengthLength, variable;
this.loginData = loginData;

@@ -89,2 +89,3 @@ lengthLength = 4;

var buffer;
this.tdsVersion = versions[this.loginData.tdsVersion];

@@ -118,2 +119,3 @@ this.packetSize = this.loginData.packetSize;

var variableData;
this.variableLengthsLength = (9 * 4) + 6 + (3 * 4) + 4;

@@ -173,2 +175,3 @@ if (this.loginData.tdsVersion === '7_1') {

var b, byte, highNibble, lowNibble, password, _i, _ref;
password = this.loginData.password || '';

@@ -175,0 +178,0 @@ password = new Buffer(password, 'ucs2');

@@ -1,3 +0,3 @@

// Generated by CoffeeScript 1.3.3
var EventEmitter, MessageIO, Packet, isPacketComplete, packetHeaderLength, packetLength,
// Generated by CoffeeScript 1.6.2
var EventEmitter, MessageIO, Packet, TYPE, isPacketComplete, packetHeaderLength, packetLength,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

@@ -19,4 +19,5 @@ __hasProp = {}.hasOwnProperty,

TYPE = require('./packet').TYPE;
MessageIO = (function(_super) {
__extends(MessageIO, _super);

@@ -29,5 +30,3 @@

this.sendPacket = __bind(this.sendPacket, this);
this.eventData = __bind(this.eventData, this);
this.socket.addListener('data', this.eventData);

@@ -41,2 +40,3 @@ this.packetDataSize = this._packetSize - packetHeaderLength;

var endOfMessage, length, packet, packetsData;
if (this.packetBuffer.length > 0) {

@@ -76,4 +76,8 @@ this.packetBuffer = Buffer.concat([this.packetBuffer, data]);

MessageIO.prototype.encryptAllFutureTraffic = function(securePair) {
MessageIO.prototype.tlsNegotiationStarting = function(securePair) {
this.securePair = securePair;
return this.tlsNegotiationInProgress = true;
};
MessageIO.prototype.encryptAllFutureTraffic = function() {
this.socket.removeAllListeners('data');

@@ -83,7 +87,9 @@ this.securePair.encrypted.removeAllListeners('data');

this.securePair.encrypted.pipe(this.socket);
return this.securePair.cleartext.addListener('data', this.eventData);
this.securePair.cleartext.addListener('data', this.eventData);
return this.tlsNegotiationInProgress = false;
};
MessageIO.prototype.sendMessage = function(packetType, data) {
MessageIO.prototype.sendMessage = function(packetType, data, resetConnection) {
var numberOfPackets, packet, packetNumber, packetPayload, payloadEnd, payloadStart, _i, _ref, _results;
numberOfPackets = (Math.floor((data.length - 1) / this.packetDataSize)) + 1;

@@ -101,5 +107,6 @@ _results = [];

packet.last(packetNumber === numberOfPackets - 1);
packet.resetConnection(resetConnection);
packet.packetId(packetNumber + 1);
packet.addData(packetPayload);
_results.push(this.sendPacket(packet));
_results.push(this.sendPacket(packet, packetType));
}

@@ -109,8 +116,12 @@ return _results;

MessageIO.prototype.sendPacket = function(packet) {
MessageIO.prototype.sendPacket = function(packet, packetType) {
this.logPacket('Sent', packet);
if (this.securePair) {
if (this.tlsNegotiationInProgress && packetType !== TYPE.PRELOGIN) {
return this.securePair.cleartext.write(packet.buffer);
} else {
return this.socket.write(packet.buffer);
if (this.securePair && !this.tlsNegotiationInProgress) {
return this.securePair.cleartext.write(packet.buffer);
} else {
return this.socket.write(packet.buffer);
}
}

@@ -117,0 +128,0 @@ };

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var TYPE, codepageByLcid, parse, sprintf;

@@ -12,2 +12,3 @@

var collation, collationData, dataLength, flags, metadata, precision, scale, schema, schemaPresent, type, typeNumber, userType;
if (tdsVersion < "7_2") {

@@ -14,0 +15,0 @@ userType = buffer.readUInt16LE();

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var DEFAULT_PACKETID, DEFAULT_SPID, DEFAULT_WINDOW, HEADER_LENGTH, NL, OFFSET, Packet, STATUS, TYPE, isPacketComplete, name, packetLength, sprintf, typeByValue, value;

@@ -52,5 +52,5 @@

Packet = (function() {
function Packet(typeOrBuffer) {
var type;
if (typeOrBuffer instanceof Buffer) {

@@ -78,4 +78,17 @@ this.buffer = typeOrBuffer;

Packet.prototype.resetConnection = function(reset) {
var status;
status = this.buffer.readUInt8(OFFSET.Status);
if (reset) {
status |= STATUS.RESETCONNECTION;
} else {
status &= 0xFF - STATUS.RESETCONNECTION;
}
return this.buffer.writeUInt8(status, OFFSET.Status);
};
Packet.prototype.last = function(last) {
var status;
status = this.buffer.readUInt8(OFFSET.Status);

@@ -120,5 +133,7 @@ if (arguments.length > 0) {

var status, statuses;
status = this.buffer.readUInt8(OFFSET.Status);
statuses = (function() {
var _results;
_results = [];

@@ -140,2 +155,3 @@ for (name in STATUS) {

var text;
indent || (indent = '');

@@ -148,2 +164,3 @@ text = sprintf('type:0x%02X(%s), status:0x%02X(%s), length:0x%04X, spid:0x%04X, packetId:0x%02X, window:0x%02X', this.buffer.readUInt8(OFFSET.Type), typeByValue[this.buffer.readUInt8(OFFSET.Type)], this.buffer.readUInt8(OFFSET.Status), this.statusAsString(), this.buffer.readUInt16BE(OFFSET.Length), this.buffer.readUInt16BE(OFFSET.SPID), this.buffer.readUInt8(OFFSET.PacketID), this.buffer.readUInt8(OFFSET.Window));

var BYTES_PER_GROUP, BYTES_PER_LINE, CHARS_PER_GROUP, chars, data, dataDump, offset, _i, _ref;
BYTES_PER_GROUP = 0x04;

@@ -150,0 +167,0 @@ CHARS_PER_GROUP = 0x08;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var ENCRYPT, MARS, PreloginPayload, SUBBUILD, TOKEN, VERSION, WritableTrackingBuffer, encryptByValue, marsByValue, name, optionBufferSize, sprintf, value;

@@ -55,3 +55,2 @@

PreloginPayload = (function() {
function PreloginPayload(bufferOrOptions) {

@@ -69,2 +68,3 @@ if (bufferOrOptions instanceof Buffer) {

var length, option, optionDataOffset, optionOffset, options, _i, _j, _len, _len1;
options = [this.createVersionOption(), this.createEncryptionOption(), this.createInstanceOption(), this.createThreadIdOption(), this.createMarsOption()];

@@ -94,2 +94,3 @@ length = 0;

var buffer;
buffer = new WritableTrackingBuffer(optionBufferSize);

@@ -106,2 +107,3 @@ buffer.writeUInt32BE(VERSION);

var buffer;
buffer = new WritableTrackingBuffer(optionBufferSize);

@@ -121,2 +123,3 @@ if (this.options.encrypt) {

var buffer;
buffer = new WritableTrackingBuffer(optionBufferSize);

@@ -132,2 +135,3 @@ buffer.writeUInt8(0x00);

var buffer;
buffer = new WritableTrackingBuffer(optionBufferSize);

@@ -143,2 +147,3 @@ buffer.writeUInt32BE(0x00);

var buffer;
buffer = new WritableTrackingBuffer(optionBufferSize);

@@ -154,2 +159,3 @@ buffer.writeUInt8(MARS.OFF);

var dataLength, dataOffset, offset, _results;
offset = 0;

@@ -156,0 +162,0 @@ _results = [];

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var EventEmitter, Request, TYPES,

@@ -11,3 +11,2 @@ __hasProp = {}.hasOwnProperty,

Request = (function(_super) {
__extends(Request, _super);

@@ -33,2 +32,3 @@

var parameter;
if (arguments.length < 4) {

@@ -66,2 +66,3 @@ if (typeof value === 'object' && !(value instanceof Date)) {

var parameter, paramsParameter, _i, _len;
paramsParameter = '';

@@ -84,2 +85,3 @@ for (_i = 0, _len = parameters.length; _i < _len; _i++) {

var parameter, _i, _len, _ref;
this.originalParameters = this.parameters;

@@ -122,2 +124,3 @@ this.parameters = [];

var parameter, _i, _len, _ref;
this.parameters = [];

@@ -124,0 +127,0 @@ this.addParameter('handle', TYPES.Int, this.handle);

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var OPTION, RpcRequestPayload, STATUS, WritableTrackingBuffer, typeByName, writeAllHeaders;

@@ -27,5 +27,5 @@

RpcRequestPayload = (function() {
function RpcRequestPayload(request, txnDescriptor) {
var buffer, optionFlags, outstandingRequestCount, parameter, statusFlags, _i, _len, _ref;
this.request = request;

@@ -32,0 +32,0 @@ buffer = new WritableTrackingBuffer(500);

@@ -1,3 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
modules.exports = {

@@ -4,0 +3,0 @@ Sp_Cursor: 1,

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var SqlBatchPayload, WritableTrackingBuffer, writeAllHeaders;

@@ -14,5 +14,5 @@

SqlBatchPayload = (function() {
function SqlBatchPayload(sqlText, txnDescriptor) {
var buffer, outstandingRequestCount;
this.sqlText = sqlText;

@@ -19,0 +19,0 @@ outstandingRequestCount = 1;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var name, value, _ref;

@@ -3,0 +3,0 @@

@@ -1,3 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
exports.statemachineLogLevel = 0;

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

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var DIGITS_REGEX, metadataParse, parser;

@@ -10,2 +10,3 @@

var c, colName, column, columnCount, columns, metadata, numberOfTableNameParts, part, tableName, _i;
columnCount = buffer.readUInt16LE();

@@ -19,2 +20,3 @@ columns = [];

var _j, _results;
_results = [];

@@ -21,0 +23,0 @@ for (part = _j = 1; 1 <= numberOfTableNameParts ? _j <= numberOfTableNameParts : _j >= numberOfTableNameParts; part = 1 <= numberOfTableNameParts ? ++_j : --_j) {

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var STATUS, doneInProcParser, doneParser, doneProcParser, parser, versions;

@@ -17,2 +17,3 @@

var attention, curCmd, inTxn, more, rowCount, rowCountValid, serverError, sqlError, status, token;
status = buffer.readUInt16LE();

@@ -48,2 +49,3 @@ more = !!(status & STATUS.MORE);

var token;
token = parser(buffer, tdsVersion);

@@ -57,2 +59,3 @@ token.name = 'DONE';

var token;
token = parser(buffer, tdsVersion);

@@ -66,2 +69,3 @@ token.name = 'DONEINPROC';

var token;
token = parser(buffer, tdsVersion);

@@ -68,0 +72,0 @@ token.name = 'DONEPROC';

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var EventEmitter, types;

@@ -45,2 +45,6 @@

name: 'TXN_ENDED'
},
18: {
name: 'RESET_CONNECTION',
event: 'resetConnection'
}

@@ -51,2 +55,3 @@ };

var length, newValue, oldValue, type, typeNumber, valueLength;
length = buffer.readUInt16LE();

@@ -69,2 +74,3 @@ typeNumber = buffer.readUInt8();

case 'ROLLBACK_TXN':
case 'RESET_CONNECTION':
valueLength = buffer.readUInt8();

@@ -71,0 +77,0 @@ newValue = buffer.readBuffer(valueLength);

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var errorParser, infoParser, parser;

@@ -6,2 +6,3 @@

var class_, length, lineNumber, message, number, procName, serverName, state, token;
length = buffer.readUInt16LE();

@@ -32,2 +33,3 @@ number = buffer.readUInt32LE();

var token;
token = parser(buffer, tdsVersion);

@@ -41,2 +43,3 @@ token.name = 'INFO';

var token;
token = parser(buffer, tdsVersion);

@@ -43,0 +46,0 @@ token.name = 'ERROR';

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var interfaceTypes, parser, versions;

@@ -13,2 +13,3 @@

var interfaceNumber, interfaceType, length, progName, progVersion, tdsVersion, tdsVersionNumber;
length = buffer.readUInt16LE();

@@ -15,0 +16,0 @@ interfaceNumber = buffer.readUInt8();

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var parser;

@@ -6,2 +6,3 @@

var c, columnCount, orderColumns, _i;
columnCount = buffer.readUInt16LE() / 2;

@@ -8,0 +9,0 @@ orderColumns = [];

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var parser;

@@ -6,2 +6,3 @@

var token, value;
value = buffer.readUInt32LE();

@@ -8,0 +9,0 @@ return token = {

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var metadataParse, parser, valueParse;

@@ -10,2 +10,3 @@

var metadata, paramName, paramOrdinal, status, token, value;
paramOrdinal = buffer.readUInt16LE();

@@ -12,0 +13,0 @@ paramName = buffer.readBVarchar();

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var DIGITS_REGEX, parser, saveColumn, sprintf, valueParse;

@@ -12,2 +12,3 @@

var column, columnMetaData, columns, value, _i, _len;
columns = [];

@@ -35,2 +36,3 @@ for (_i = 0, _len = columnsMetaData.length; _i < _len; _i++) {

var entry;
entry = columns[columnName];

@@ -37,0 +39,0 @@ if (!entry) {

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var EventEmitter, Parser, ReadableTrackingBuffer, TYPE, tokenParsers,

@@ -51,3 +51,2 @@ __hasProp = {}.hasOwnProperty,

Parser = (function(_super) {
__extends(Parser, _super);

@@ -68,3 +67,2 @@

'NOOP';
}

@@ -79,3 +77,4 @@ return this.buffer.position = this.position;

Parser.prototype.nextToken = function() {
var token, type;
var error, token, type;
try {

@@ -102,3 +101,4 @@ type = this.buffer.readUInt8();

}
} catch (error) {
} catch (_error) {
error = _error;
if ((error != null ? error.error : void 0) === 'oob') {

@@ -105,0 +105,0 @@ return false;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var TYPE;

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var convertLEBytesToString, getNextRemainder, invert, isZero;

@@ -6,2 +6,3 @@

var byte, _i, _len;
for (_i = 0, _len = array.length; _i < _len; _i++) {

@@ -18,2 +19,3 @@ byte = array[_i];

var index, remainder, s, _i, _ref;
remainder = 0;

@@ -30,2 +32,3 @@ for (index = _i = _ref = array.length - 1; _i >= 0; index = _i += -1) {

var byte, index, _i, _j, _len, _len1, _results;
for (index = _i = 0, _len = array.length; _i < _len; index = ++_i) {

@@ -50,2 +53,3 @@ byte = array[index];

var array, result, sign, t;
array = Array.prototype.slice.call(buffer, 0, buffer.length);

@@ -52,0 +56,0 @@ if (isZero(array)) {

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var ReadableTrackingBuffer, convertLEBytesToString;

@@ -15,3 +15,2 @@

ReadableTrackingBuffer = (function() {
function ReadableTrackingBuffer(buffer, encoding) {

@@ -35,2 +34,3 @@ this.buffer = buffer;

var available;
this.previousPosition = this.position;

@@ -40,5 +40,3 @@ available = this.buffer.length - this.position;

throw {
error: 'oob'
};
return {
error: 'oob',
message: "required : " + lengthRequired + ", available : " + available

@@ -59,2 +57,3 @@ };

var length, value;
length = 1;

@@ -68,2 +67,3 @@ this.assertEnoughLeftFor(length);

var length;
length = 2;

@@ -77,2 +77,3 @@ this.assertEnoughLeftFor(length);

var length;
length = 2;

@@ -86,2 +87,3 @@ this.assertEnoughLeftFor(length);

var length;
length = 4;

@@ -95,2 +97,3 @@ this.assertEnoughLeftFor(length);

var length;
length = 4;

@@ -104,2 +107,3 @@ this.assertEnoughLeftFor(length);

var length, value;
length = 1;

@@ -113,2 +117,3 @@ this.assertEnoughLeftFor(length);

var length;
length = 2;

@@ -122,2 +127,3 @@ this.assertEnoughLeftFor(length);

var length;
length = 2;

@@ -131,2 +137,3 @@ this.assertEnoughLeftFor(length);

var length;
length = 4;

@@ -140,2 +147,3 @@ this.assertEnoughLeftFor(length);

var length;
length = 4;

@@ -149,2 +157,3 @@ this.assertEnoughLeftFor(length);

var length;
length = 4;

@@ -158,2 +167,3 @@ this.assertEnoughLeftFor(length);

var length;
length = 8;

@@ -167,2 +177,3 @@ this.assertEnoughLeftFor(length);

var high, low;
low = this.readUInt32LE();

@@ -178,2 +189,3 @@ high = this.readUInt32LE();

var high, low;
low = this.readUInt32LE();

@@ -186,2 +198,3 @@ high = this.readUInt32LE();

var dword1, dword2, dword3;
dword1 = this.readUInt32LE();

@@ -195,2 +208,3 @@ dword2 = this.readUInt32LE();

var dword1, dword2, dword3, dword4;
dword1 = this.readUInt32LE();

@@ -212,2 +226,3 @@ dword2 = this.readUInt32LE();

var length, multiplier;
encoding || (encoding = this.encoding);

@@ -221,2 +236,3 @@ multiplier = encoding === 'ucs2' ? 2 : 1;

var length, multiplier;
encoding || (encoding = this.encoding);

@@ -223,0 +239,0 @@ multiplier = encoding === 'ucs2' ? 2 : 1;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var ReadableTrackingBuffer, WritableTrackingBuffer;

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var WritableTrackingBuffer, buffertools;

@@ -15,3 +15,2 @@

WritableTrackingBuffer = (function() {
function WritableTrackingBuffer(sizeIncrement, encoding) {

@@ -37,2 +36,3 @@ this.sizeIncrement = sizeIncrement;

var buffer;
size || (size = this.sizeIncrement);

@@ -51,2 +51,3 @@ buffer = this.buffer.slice(0, this.position);

var length;
length = 1;

@@ -60,2 +61,3 @@ this.makeRoomFor(length);

var length;
length = 2;

@@ -73,2 +75,3 @@ this.makeRoomFor(length);

var length;
length = 2;

@@ -82,2 +85,3 @@ this.makeRoomFor(length);

var length;
length = 4;

@@ -91,2 +95,3 @@ this.makeRoomFor(length);

var high, low;
low = value % 0x100000000;

@@ -100,2 +105,3 @@ high = Math.floor(value / 0x100000000);

var length;
length = 4;

@@ -109,2 +115,3 @@ this.makeRoomFor(length);

var length;
length = 1;

@@ -118,2 +125,3 @@ this.makeRoomFor(length);

var length;
length = 2;

@@ -127,2 +135,3 @@ this.makeRoomFor(length);

var length;
length = 2;

@@ -136,2 +145,3 @@ this.makeRoomFor(length);

var length;
length = 4;

@@ -145,2 +155,3 @@ this.makeRoomFor(length);

var length;
length = 4;

@@ -154,2 +165,3 @@ this.makeRoomFor(length);

var length;
length = 4;

@@ -163,2 +175,3 @@ this.makeRoomFor(length);

var length;
length = 8;

@@ -172,2 +185,3 @@ this.makeRoomFor(length);

var bytesWritten, length;
encoding || (encoding = this.encoding);

@@ -193,2 +207,3 @@ length = Buffer.byteLength(value, encoding);

var length;
length = value.length;

@@ -195,0 +210,0 @@ this.makeRoomFor(length);

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var ISOLATION_LEVEL, OPERATION_TYPE, Transaction, WritableTrackingBuffer, isolationLevelByValue, name, value, writeAllHeaders;

@@ -40,3 +40,2 @@

Transaction = (function() {
function Transaction(name, isolationLevel) {

@@ -51,2 +50,3 @@ this.name = name;

_this = this;
buffer = new WritableTrackingBuffer(100, 'ucs2');

@@ -69,2 +69,3 @@ writeAllHeaders(buffer, txnDescriptor, this.outstandingRequestCount);

_this = this;
buffer = new WritableTrackingBuffer(100, 'ascii');

@@ -87,2 +88,3 @@ writeAllHeaders(buffer, txnDescriptor, this.outstandingRequestCount);

_this = this;
buffer = new WritableTrackingBuffer(100, 'ascii');

@@ -89,0 +91,0 @@ writeAllHeaders(buffer, txnDescriptor, this.outstandingRequestCount);

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.3
// Generated by CoffeeScript 1.6.2
var MAX, MONEY_DIVISOR, NULL, PLP_NULL, THREE_AND_A_THIRD, UNKNOWN_PLP_LEN, guidParser, iconv, parse, readBinary, readChars, readDateTime, readMax, readMaxBinary, readMaxChars, readMaxNChars, readNChars, readSmallDateTime, sprintf;

@@ -26,2 +26,3 @@

var codepage, dataLength, high, low, sign, textPointerLength, textPointerNull, type, value;
value = void 0;

@@ -314,2 +315,3 @@ dataLength = void 0;

var chunk, chunkLength, chunks, expectedLength, length, position, type, valueBuffer, _i, _len;
type = buffer.readBuffer(8);

@@ -351,2 +353,3 @@ if (type.equals(PLP_NULL)) {

var days, minutes, value;
days = buffer.readUInt16LE();

@@ -362,2 +365,3 @@ minutes = buffer.readUInt16LE();

var days, milliseconds, threeHundredthsOfSecond, value;
days = buffer.readInt32LE();

@@ -364,0 +368,0 @@ threeHundredthsOfSecond = buffer.readUInt32LE();

@@ -27,3 +27,3 @@ {

],
"version": "0.1.3",
"version": "0.1.4",
"main": "./lib/tedious.js",

@@ -35,12 +35,12 @@ "repository": {

"engines": {
"node": "0.6 || 0.7 || 0.8"
"node": "0.6 || 0.7 || 0.8 || 0.9"
},
"dependencies": {
"async": "0.1.22",
"iconv-lite": "0.2.4",
"async": "0.2.6",
"iconv-lite": "0.2.7",
"sprintf": "0.1.1"
},
"devDependencies": {
"coffee-script": "1.3.3",
"nodeunit": "0.7.4"
"coffee-script": "1.6.2",
"nodeunit": "0.8.0"
},

@@ -47,0 +47,0 @@ "scripts": {

@@ -32,3 +32,3 @@ Tedious (node implementation of TDS)

-------------
More documentation is available at [pekim.github.com/tedious/](http://pekim.github.com/tedious/)
More documentation is available at [pekim.github.io/tedious/](http://pekim.github.io/tedious/)

@@ -35,0 +35,0 @@ Discussion

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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