diff --git a/lib/api/tooling.js b/lib/api/tooling.js index 423f2d8e8..7db42076c 100644 --- a/lib/api/tooling.js +++ b/lib/api/tooling.js @@ -21,7 +21,6 @@ var Tooling = function(conn) { var delegates = [ "query", "queryMore", - "_ensureVersion", "_toRecordResult", "create", "_createSingle", @@ -91,6 +90,17 @@ Tooling.prototype._baseUrl = function() { return this._conn._baseUrl() + "/tooling"; }; +/** + * @private + */ +Tooling.prototype._supports = function(feature) { + // should return false in order not to use compsite collection + if (feature === 'sobject-collection') { + return false; + } + return this._conn._supports.apply(this._conn, arguments); +}; + /** * @private */ diff --git a/lib/connection.js b/lib/connection.js index 424100eae..573e1b6cb 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -559,6 +559,16 @@ Connection.prototype._ensureVersion = function(majorVersion) { return parseInt(versions[0], 10) >= majorVersion; } +/** @private */ +Connection.prototype._supports = function(feature) { + switch (feature) { + case 'sobject-collection': + return this._ensureVersion(42); + default: + return false; + } +} + /** * Retrieve specified records * @@ -578,7 +588,7 @@ Connection.prototype.retrieve = function(type, ids, options, callback) { options = options || {}; return ( _.isArray(ids) ? - (this._ensureVersion(42) ? // check the version whether SObject collection API is supported (42.0) + (this._supports('sobject-collection') ? // check whether SObject collection API is supported this._retrieveMany(type, ids, options) : this._retrieveParallel(type, ids, options)) : this._retrieveSingle(type, ids, options) @@ -722,7 +732,7 @@ Connection.prototype.create = function(type, records, options, callback) { options = options || {}; return ( _.isArray(records) ? - (this._ensureVersion(42) ? // check the version whether SObject collection API is supported (42.0) + (this._supports('sobject-collection') ? // check whether SObject collection API is supported this._createMany(type, records, options) : this._createParallel(type, records, options)) : this._createSingle(type, records, options) @@ -835,7 +845,7 @@ Connection.prototype.update = function(type, records, options, callback) { options = options || {}; return ( _.isArray(records) ? - (this._ensureVersion(42) ? // check the version whether SObject collection API is supported (42.0) + (this._supports('sobject-collection') ? // check whether SObject collection API is supported this._updateMany(type, records, options) : this._updateParallel(type, records, options)) : this._updateSingle(type, records, options) @@ -1046,7 +1056,7 @@ Connection.prototype.destroy = function(type, ids, options, callback) { options = options || {}; return ( _.isArray(ids) ? - (this._ensureVersion(42) ? // check the version whether SObject collection API is supported (42.0) + (this._supports('sobject-collection') ? // check whether SObject collection API is supported this._destroyMany(type, ids, options) : this._destroyParallel(type, ids, options)) : this._destroySingle(type, ids, options)