Socket
Socket
Sign inDemoInstall

dse-driver

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dse-driver - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

index.d.ts

2

index.js
/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -138,3 +138,3 @@ * Please see the license for details:

} else {
this.kerberosClient.wrap(response, cb);
this.kerberosClient.wrap(response, null, cb);
}

@@ -141,0 +141,0 @@ });

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -14,2 +14,3 @@ * Please see the license for details:

const metrics = require('./metrics');
const auth = require('./auth');

@@ -134,6 +135,13 @@ /** Core connections per host for protocol versions 1 and 2 */

validatePoliciesOptions(options.policies);
validateProtocolOptions(options.protocolOptions);
validateSocketOptions(options.socketOptions);
validateAuthenticationOptions(options);
options.encoding = options.encoding || {};
validateEncodingOptions(options.encoding);
if (options.profiles && !util.isArray(options.profiles)) {

@@ -210,2 +218,23 @@ throw new TypeError('profiles must be an Array of ExecutionProfile instances');

/**
* Validates authentication provider and credentials.
* @param {ClientOptions} options
* @private
*/
function validateAuthenticationOptions(options) {
const credentials = options.credentials;
if (credentials && !options.authProvider) {
if (typeof credentials.username !== 'string' || typeof credentials.password !== 'string') {
throw new TypeError('credentials username and password must be a string');
}
options.authProvider = new auth.PlainTextAuthProvider(credentials.username, credentials.password);
}
if (options.authProvider && !(options.authProvider instanceof auth.AuthProvider)) {
throw new TypeError('options.authProvider must be an instance of AuthProvider');
}
}
/**
* Validates the encoding options.

@@ -212,0 +241,0 @@ * @param {ClientOptions.encoding} encodingOptions

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -55,2 +55,11 @@ * Please see the license for details:

* @property {String} keyspace The logged keyspace for all the connections created within the {@link Client} instance.
* @property {Object} [credentials] An object containing the username and password for plain-text authentication.
* It configures the authentication provider to be used against Apache Cassandra's PasswordAuthenticator or DSE's
* DseAuthenticator, when default auth scheme is plain-text.
* <p>
* Note that you should configure either <code>credentials</code> or <code>authProvider</code> to connect to an
* auth-enabled cluster, but not both.
* </p>
* @property {String} credentials.username The username to use for plain-text authentication.
* @property {String} credentials.password The password to use for plain-text authentication.
* @property {Number} refreshSchemaDelay The default window size in milliseconds used to debounce node list and schema

@@ -57,0 +66,0 @@ * refresh metadata requests. Default: 1000.

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -91,2 +91,3 @@ * Please see the license for details:

* In the case of other types, they are going to be decoded as a <code>null</code> value.
* @private
* @type {Set}

@@ -334,8 +335,11 @@ */

};
this.decodeTuple = function (bytes, tupleInfo) {
const elements = new Array(tupleInfo.length);
let offset = 0;
for (let i = 0; i < tupleInfo.length; i++) {
for (let i = 0; i < tupleInfo.length && offset < bytes.length; i++) {
const length = bytes.readInt32BE(offset);
offset += 4;
if (length < 0) {

@@ -345,12 +349,25 @@ elements[i] = null;

}
elements[i] = this.decode(bytes.slice(offset, offset+length), tupleInfo[i]);
offset += length;
}
return new types.Tuple(elements);
return types.Tuple.fromArray(elements);
};
//Encoding methods
this.encodeFloat = function (value) {
if (typeof value === 'string') {
// All numeric types are supported as strings for historical reasons
value = parseFloat(value);
if (Number.isNaN(value)) {
throw new TypeError(`Expected string representation of a number, obtained ${util.inspect(value)}`);
}
}
if (typeof value !== 'number') {
throw new TypeError('Expected Number, obtained ' + util.inspect(value));
}
const buf = utils.allocBufferUnsafe(4);

@@ -360,6 +377,17 @@ buf.writeFloatBE(value, 0);

};
this.encodeDouble = function (value) {
if (typeof value === 'string') {
// All numeric types are supported as strings for historical reasons
value = parseFloat(value);
if (Number.isNaN(value)) {
throw new TypeError(`Expected string representation of a number, obtained ${util.inspect(value)}`);
}
}
if (typeof value !== 'number') {
throw new TypeError('Expected Number, obtained ' + util.inspect(value));
}
const buf = utils.allocBufferUnsafe(8);

@@ -369,2 +397,3 @@ buf.writeDoubleBE(value, 0);

};
/**

@@ -500,2 +529,7 @@ * @param {Date|String|Long|Number} value

this._encodeBigIntFromBigInt = function (value) {
if (typeof value === 'string') {
// All numeric types are supported as strings for historical reasons
value = BigInt(value);
}
// eslint-disable-next-line valid-typeof

@@ -543,2 +577,7 @@ if (typeof value !== 'bigint') {

this._encodeVarintFromBigInt = function (value) {
if (typeof value === 'string') {
// All numeric types are supported as strings for historical reasons
value = BigInt(value);
}
// eslint-disable-next-line valid-typeof

@@ -801,5 +840,8 @@ if (typeof value !== 'bigint') {

let totalLength = 0;
for (let i = 0; i < tupleInfo.length; i++) {
const length = Math.min(tupleInfo.length, value.length);
for (let i = 0; i < length; i++) {
const type = tupleInfo[i];
const item = this.encode(value.get(i), type);
if (!item) {

@@ -810,2 +852,3 @@ parts.push(nullValueBuffer);

}
if (item === types.unset) {

@@ -816,2 +859,3 @@ parts.push(unsetValueBuffer);

}
const lengthBuffer = utils.allocBufferUnsafe(4);

@@ -823,2 +867,3 @@ lengthBuffer.writeInt32BE(item.length, 0);

}
return Buffer.concat(parts, totalLength);

@@ -825,0 +870,0 @@ };

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

@@ -59,5 +59,12 @@ /**

if (docInfo.orderBy && docInfo.orderBy.length > 0) {
if (docInfo.orderBy) {
yield '|o|';
yield* docInfo.orderBy;
// orderBy is uses property names as keys and 'asc'/'desc' as values
const keys = Object.keys(docInfo.orderBy);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
yield key;
yield docInfo.orderBy[key];
}
}

@@ -64,0 +71,0 @@ }

@@ -18,3 +18,3 @@ /**

exports.ModelBatchMapper = require('./model-batch-mapper');
exports.ModelBatchItem = require('./model-batch-item');
exports.ModelBatchItem = require('./model-batch-item').ModelBatchItem;
exports.Result = require('./result');

@@ -21,0 +21,0 @@ const tableMappingsModule = require('./table-mappings');

@@ -17,3 +17,3 @@ /**

const ModelMappingInfo = require('./model-mapping-info');
const ModelBatchItem = require('./model-batch-item');
const ModelBatchItem = require('./model-batch-item').ModelBatchItem;

@@ -20,0 +20,0 @@ /**

@@ -10,2 +10,4 @@ /**

const Cache = require('./cache');
/**

@@ -17,15 +19,49 @@ * Represents a query or a set of queries used to perform a mutation in a batch.

/**
* @param {Promise<Array>} queries
* @param {Object} doc
* @param {Object} docInfo
* @param {ModelMappingInfo} mappingInfo
* @param {MappingHandler} handler
* @param {Tree} cache
*/
constructor(queries, doc, docInfo, mappingInfo) {
this._queries = queries;
this._doc = doc;
this._docInfo = docInfo;
this._mappingInfo = mappingInfo;
constructor(doc, docInfo, handler, cache) {
this.doc = doc;
this.docInfo = docInfo;
this.handler = handler;
this.cache = cache;
}
/**
* @ignore
* @returns <Promise<Array>>
*/
getQueries() {
const docKeys = Object.keys(this.doc);
const cacheItem = this.cache.getOrCreate(this.getCacheKey(docKeys), () => ({ queries: null }));
if (cacheItem.queries === null) {
cacheItem.queries = this.createQueries(docKeys);
}
return cacheItem.queries;
}
/**
* Gets the cache key for this item.
* @abstract
* @param {Array} docKeys
*/
getCacheKey(docKeys) {
throw new Error('getCacheKey must be implemented');
}
/**
* Gets the Promise to create the queries.
* @abstract
* @param {Array} docKeys
* @returns {Promise<Array>}
*/
createQueries(docKeys) {
throw new Error('getCacheKey must be implemented');
}
/**
* Pushes the queries and parameters represented by this instance to the provided array.

@@ -40,3 +76,4 @@ * @internal

let isCounter;
return this._queries.then(queries => {
return this.getQueries().then(queries => {
queries.forEach(q => {

@@ -49,3 +86,3 @@ // It's idempotent if all the queries contained are idempotent

arr.push({ query: q.query, params: q.paramsGetter(this._doc, this._docInfo) });
arr.push({ query: q.query, params: q.paramsGetter(this.doc, this.docInfo) });
});

@@ -63,6 +100,87 @@

getMappingInfo() {
return this._mappingInfo;
return this.handler.info;
}
}
module.exports = ModelBatchItem;
/**
* Represents a single or a set of INSERT queries in a batch.
* @ignore
* @internal
*/
class InsertModelBatchItem extends ModelBatchItem {
/**
* @param {Object} doc
* @param {Object} docInfo
* @param {MappingHandler} handler
* @param {Tree} cache
*/
constructor(doc, docInfo, handler, cache) {
super(doc, docInfo, handler, cache);
}
/** @override */
getCacheKey(docKeys) {
return Cache.getInsertKey(docKeys, this.docInfo);
}
/** @override */
createQueries(docKeys) {
return this.handler.createInsertQueries(docKeys, this.doc, this.docInfo);
}
}
/**
* Represents a single or a set of UPDATE queries in a batch.
* @ignore
* @internal
*/
class UpdateModelBatchItem extends ModelBatchItem {
/**
* @param {Object} doc
* @param {Object} docInfo
* @param {MappingHandler} handler
* @param {Tree} cache
*/
constructor(doc, docInfo, handler, cache) {
super(doc, docInfo, handler, cache);
}
/** @override */
getCacheKey(docKeys) {
return Cache.getUpdateKey(docKeys, this.doc, this.docInfo);
}
/** @override */
createQueries(docKeys) {
return this.handler.createUpdateQueries(docKeys, this.doc, this.docInfo);
}
}
/**
* Represents a single or a set of DELETE queries in a batch.
* @ignore
* @internal
*/
class RemoveModelBatchItem extends ModelBatchItem {
/**
* @param {Object} doc
* @param {Object} docInfo
* @param {MappingHandler} handler
* @param {Tree} cache
*/
constructor(doc, docInfo, handler, cache) {
super(doc, docInfo, handler, cache);
}
/** @override */
getCacheKey(docKeys) {
return Cache.getRemoveKey(docKeys, this.doc, this.docInfo);
}
/** @override */
createQueries(docKeys) {
return this.handler.createDeleteQueries(docKeys, this.doc, this.docInfo);
}
}
module.exports = { ModelBatchItem, InsertModelBatchItem, UpdateModelBatchItem, RemoveModelBatchItem };

@@ -10,5 +10,7 @@ /**

const Cache = require('./cache');
const Tree = require('./tree');
const ModelBatchItem = require('./model-batch-item');
const moduleBatchItemModule = require('./model-batch-item');
const InsertModelBatchItem = moduleBatchItemModule.InsertModelBatchItem;
const UpdateModelBatchItem = moduleBatchItemModule.UpdateModelBatchItem;
const RemoveModelBatchItem = moduleBatchItemModule.RemoveModelBatchItem;

@@ -54,11 +56,3 @@ /**

insert(doc, docInfo) {
const docKeys = Object.keys(doc);
const cacheKey = Cache.getInsertKey(docKeys, docInfo);
const cacheItem = this._cache.insert.getOrCreate(cacheKey, () => ({ queries: null }));
if (cacheItem.queries === null) {
cacheItem.queries = this._handler.createInsertQueries(docKeys, doc, docInfo);
}
return new ModelBatchItem(cacheItem.queries, doc, docInfo, this._handler.info);
return new InsertModelBatchItem(doc, docInfo, this._handler, this._cache.insert);
}

@@ -89,11 +83,3 @@

update(doc, docInfo) {
const docKeys = Object.keys(doc);
const cacheKey = Cache.getUpdateKey(docKeys, doc, docInfo);
const cacheItem = this._cache.update.getOrCreate(cacheKey, () => ({ queries: null }));
if (cacheItem.queries === null) {
cacheItem.queries = this._handler.createUpdateQueries(docKeys, doc, docInfo);
}
return new ModelBatchItem(cacheItem.queries, doc, docInfo, this._handler.info);
return new UpdateModelBatchItem(doc, docInfo, this._handler, this._cache.update);
}

@@ -129,11 +115,3 @@

remove(doc, docInfo) {
const docKeys = Object.keys(doc);
const cacheKey = Cache.getRemoveKey(docKeys, doc, docInfo);
const cacheItem = this._cache.remove.getOrCreate(cacheKey, () => ({ queries: null }));
if (cacheItem.queries === null) {
cacheItem.queries = this._handler.createDeleteQueries(docKeys, doc, docInfo);
}
return new ModelBatchItem(cacheItem.queries, doc, docInfo, this._handler.info);
return new RemoveModelBatchItem(doc, docInfo, this._handler, this._cache.update);
}

@@ -140,0 +118,0 @@ }

@@ -10,2 +10,8 @@ /**

const keyMatches = {
all: 1,
none: 0,
some: -1
};
/**

@@ -41,6 +47,3 @@ * Provides utility methods to choose the correct tables and views that should be included in a statement.

const allPartitionKeysAreIncluded = table.partitionKeys
.reduce((acc, c) => acc && contains(propertiesInfo, p => p.columnName === c.name), true);
if (!allPartitionKeysAreIncluded) {
if (keysAreIncluded(table.partitionKeys, propertiesInfo) !== keyMatches.all) {
// Not all the partition keys are covered

@@ -50,6 +53,5 @@ continue;

if (allPKsDefined) {
const allClusteringKeysAreIncluded = table.clusteringKeys
.reduce((acc, c) => acc && contains(propertiesInfo, p => p.columnName === c.name), true);
if (!allClusteringKeysAreIncluded) {
if (keysAreIncluded(table.clusteringKeys, propertiesInfo) !== keyMatches.all) {
// All clustering keys should be included as allPKsDefined flag is set

@@ -83,7 +85,19 @@ continue;

// ORDER BY fields must be part of the clustering keys
// On the mapper we only validate that are part of the table
// CQL:
// - "ORDER BY" is currently only supported on the clustered columns of the PRIMARY KEY
// - "ORDER BY" currently only support the ordering of columns following their declared order in
// the PRIMARY KEY
//
// In the mapper, we validate that the ORDER BY columns appear in the same order as in the clustering keys
const containsAllOrderByColumns = orderByColumns
.reduce((acc, order) => acc && table.columnsByName[order[0]] !== undefined, true);
.reduce((acc, order, index) => {
if (!acc) {
return false;
}
const ck = table.clusteringKeys[index];
return ck && ck.name === order[0];
}, true);
if (!containsAllOrderByColumns) {

@@ -131,13 +145,20 @@ continue;

// All partition and clustering keys from the table should be included in the document
const keyNames = table.partitionKeys.concat(table.clusteringKeys).map(k => k.name);
const columns = propertiesInfo.map(m => m.columnName);
if (keysAreIncluded(table.partitionKeys, propertiesInfo) !== keyMatches.all) {
// Not all the partition keys are covered
return false;
}
for (let i = 0; i < keyNames.length; i++) {
if (columns.indexOf(keyNames[i]) === -1) {
return false;
}
const clusteringKeyMatches = keysAreIncluded(table.clusteringKeys, propertiesInfo);
// All clustering keys should be included or it can be inserting a static column value
if (clusteringKeyMatches === keyMatches.all) {
return true;
}
return true;
if (clusteringKeyMatches === keyMatches.some) {
return false;
}
const staticColumns = staticColumnCount(table);
return propertiesInfo.length === table.partitionKeys.length + staticColumns && staticColumns > 0;
});

@@ -171,17 +192,26 @@

// All partition and clustering keys from the table should be included in the document
const keyNames = table.partitionKeys.concat(table.clusteringKeys).map(k => k.name);
const columns = new Set(propertiesInfo.map(p => p.columnName));
const allPrimaryKeysAreContained = keyNames.reduce((acc, key) => acc && columns.has(key), true);
if (keysAreIncluded(table.partitionKeys, propertiesInfo) !== keyMatches.all) {
// Not all the partition keys are covered
return false;
}
if (!allPrimaryKeysAreContained) {
const clusteringKeyMatches = keysAreIncluded(table.clusteringKeys, propertiesInfo);
// All clustering keys should be included or it can be updating a static column value
if (clusteringKeyMatches === keyMatches.some) {
return false;
}
if (clusteringKeyMatches === keyMatches.none && !hasStaticColumn(table)) {
return false;
}
const applicableColumns = propertiesInfo
.reduce((acc, p) => acc + (table.columnsByName[p.columnName] !== undefined ? 1 : 0), 0);
if (applicableColumns <= keyNames.length) {
// No SET columns are defined
return false;
if (applicableColumns <= table.partitionKeys.length + table.clusteringKeys.length) {
if (!hasStaticColumn(table) || applicableColumns <= table.partitionKeys.length) {
// UPDATE statement does not contain columns to SET
return false;
}
}

@@ -259,2 +289,31 @@

module.exports = ObjectSelector;
/**
* Returns the amount of matches for a given key
* @private
* @param {Array} keys
* @param {Array} propertiesInfo
*/
function keysAreIncluded(keys, propertiesInfo) {
if (keys.length === 0) {
return keyMatches.all;
}
// Filtering by name might look slow / ineffective to using hash maps
// but we expect `keys` and `propertiesInfo` to contain only few items
const matches = propertiesInfo.reduce((acc, p) => acc + (contains(keys, k => p.columnName === k.name) ? 1 : 0), 0);
if (matches === 0) {
return keyMatches.none;
}
return matches === keys.length ? keyMatches.all : keyMatches.some;
}
function hasStaticColumn(table) {
return staticColumnCount(table) > 0;
}
function staticColumnCount(table) {
return table.columns.reduce((acc, column) => acc + (column.isStatic ? 1 : 0), 0);
}
module.exports = ObjectSelector;

@@ -177,6 +177,2 @@ /**

if (filteredPropertiesInfo.length <= primaryKeys.size) {
throw new Error('UPDATE statement does not contain columns to SET');
}
return {

@@ -202,4 +198,10 @@ query: QueryGenerator._getUpdateQuery(

static _getUpdateQuery(tableName, keyspace, primaryKeys, propertiesInfo, when, ifExists, ttl) {
let query = `UPDATE ${keyspace}.${tableName} SET `;
let query = `UPDATE ${keyspace}.${tableName} `;
if (typeof ttl === 'number') {
query += 'USING TTL ? ';
}
query += 'SET ';
query += propertiesInfo

@@ -231,6 +233,2 @@ .filter(p => !primaryKeys.has(p.columnName))

if (typeof ttl === 'number') {
query += ' USING TTL ?';
}
return query;

@@ -251,5 +249,10 @@ }

if (typeof ttl === 'number') {
scriptText += `docInfo['ttl'], `;
}
// Assignment clause
scriptText += QueryGenerator._assignmentGetterExpression(propertiesInfo.filter(p => !primaryKeys.has(p.columnName)));
scriptText += ', ';
// Where clause

@@ -263,6 +266,2 @@ scriptText += QueryGenerator._valueGetterExpression(propertiesInfo.filter(p => primaryKeys.has(p.columnName)));

if (typeof ttl === 'number') {
scriptText += `, docInfo['ttl']`;
}
// Finish return statement

@@ -269,0 +268,0 @@ scriptText += '];\n})';

@@ -102,3 +102,3 @@ /**

toArray() {
if (this._isEmptyLwt) {
if (this._isEmptyLwt || !this._rs.rows) {
return utils.emptyArray;

@@ -105,0 +105,0 @@ }

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -1030,3 +1030,3 @@ * Please see the license for details:

const existingKeys = Object.keys(this._mapByKey);
for (let i = 0; i < existingKeys.length && this.length - toRemove.length < this._maxPrepared; i++) {
for (let i = 0; i < existingKeys.length && this.length - toRemove.length >= this._maxPrepared; i++) {
const info = this._mapByKey[existingKeys[i]];

@@ -1040,3 +1040,3 @@ if (!info.queryId) {

toRemove.forEach(function (item) {
delete this._mapByKey[item.query];
delete this._mapByKey[this._getKey(item.keyspace, item.query)];
delete this._mapById[item.queryId];

@@ -1043,0 +1043,0 @@ this.length--;

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -504,6 +504,8 @@ * Please see the license for details:

name: row['column_name'],
type: type
type: type,
isStatic: false
};
tableInfo.columns.push(c);
columnsKeyed[c.name] = c;
switch (row['type']) {

@@ -520,2 +522,6 @@ case 'partition_key':

break;
case 'static':
// C* 2.0.6+ supports static columns
c.isStatic = true;
break;
}

@@ -522,0 +528,0 @@ }

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -190,2 +190,20 @@ * Please see the license for details:

/**
* Reads an associative array of strings as keys and string lists as values
* @returns {Object}
*/
FrameReader.prototype.readStringMultiMap = function () {
//A [short] n, followed by n pair <k><v> where <k> is a
//[string] and <v> is a [string[]].
const length = this.readShort();
if (length < 0) {
return null;
}
const map = {};
for (let i = 0; i < length; i++) {
map[this.readString()] = this.readStringList();
}
return map;
};
/**
* Reads a data type definition

@@ -192,0 +210,0 @@ * @returns {{code: Number, info: Object|null}} An array of 2 elements

/**
* Copyright (C) 2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -202,3 +202,3 @@ * Please see the license for details:

case types.opcodes.supported:
return this.push({ header: frameInfo.header });
return this.push({ header: frameInfo.header, supported: reader.readStringMultiMap()});
case types.opcodes.event:

@@ -205,0 +205,0 @@ return this.push({ header: frameInfo.header, event: reader.readEvent()});

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -7,4 +7,5 @@ * Please see the license for details:

*/
'use strict';
const util = require('util');
"use strict";
/** @module types */

@@ -24,17 +25,13 @@ /**

function Tuple() {
let elements = Array.prototype.slice.call(arguments);
if (elements.length === 0) {
throw new TypeError('Tuple must contain at least one value');
}
if (elements.length === 1 && util.isArray(elements)) {
//The first argument is an array of the elements, use a copy of the array
elements = elements[0];
}
/**
/**
* Immutable elements of Tuple object.
* @type Array
*/
this.elements = elements;
this.elements = Array.prototype.slice.call(arguments);
if (this.elements.length === 0) {
throw new TypeError('Tuple must contain at least one value');
}
/**

@@ -53,4 +50,6 @@ * Returns the number of the elements.

Tuple.fromArray = function (elements) {
//Use a copy of an array
return new Tuple(elements.slice(0));
// No spread operator in Node.js 4 :/
// return new Tuple(...elements);
// Apply the elements Array as parameters
return new (Function.prototype.bind.apply(Tuple, [ null ].concat(elements)));
};

@@ -57,0 +56,0 @@

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

/**
* Copyright (C) 2016-2017 DataStax, Inc.
* Copyright DataStax, Inc.
*

@@ -4,0 +4,0 @@ * Please see the license for details:

{
"name": "dse-driver",
"version": "2.1.0",
"version": "2.2.0",
"description": "DataStax Enterprise Node.js Driver",

@@ -21,3 +21,5 @@ "author": "DataStax",

"dependencies": {
"long": "^2.2.0"
"long": "^2.2.0",
"@types/node": ">=4",
"@types/long": "^4.0.0"
},

@@ -29,3 +31,3 @@ "devDependencies": {

},
"homepage": "http://docs.datastax.com/en/developer/nodejs-driver-dse/latest/",
"homepage": "https://docs.datastax.com/en/developer/nodejs-driver-dse/latest/",
"bugs": {

@@ -32,0 +34,0 @@ "url": "https://groups.google.com/a/lists.datastax.com/forum/#!forum/nodejs-driver-user"

@@ -286,5 +286,5 @@ # DataStax Enterprise Node.js Driver

Copyright 2016-2018 DataStax
© DataStax, Inc.
http://www.datastax.com/terms/datastax-dse-driver-license-terms
The full license terms are available at https://www.datastax.com/terms/datastax-dse-driver-license-terms

@@ -291,0 +291,0 @@

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