Skip to content

Commit 73afbe3

Browse files
author
vvo
committed
3.18.0
* fix(debug): only activate debug messages on NODE_ENV==='debug' * feat(lite): add getObjects
1 parent 92cf93c commit 73afbe3

13 files changed

+511
-415
lines changed

ChangeLog

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
CHANGELOG
22

3+
2016-07-22 3.18.0
4+
35
* fix(debug): only activate debug messages on NODE_ENV==='debug'
46
* feat(lite): add getObjects
57

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "algoliasearch",
3-
"version": "3.17.0",
3+
"version": "3.18.0",
44
"homepage": "https://github.com/algolia/algoliasearch-client-js",
55
"authors": [
66
"Algolia Team <[email protected]>"

dist/algoliasearch.angular.js

+93-89
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! algoliasearch 3.17.0 | © 2014, 2015 Algolia SAS | github.com/algolia/algoliasearch-client-js */
1+
/*! algoliasearch 3.18.0 | © 2014, 2015 Algolia SAS | github.com/algolia/algoliasearch-client-js */
22
(function(f){var g;if(typeof window!=='undefined'){g=window}else if(typeof self!=='undefined'){g=self}g.ALGOLIA_MIGRATION_LAYER=f()})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
33

44
module.exports = function load (src, opts, cb) {
@@ -3447,88 +3447,6 @@ Index.prototype.addObjects = function(objects, callback) {
34473447
});
34483448
};
34493449

3450-
/*
3451-
* Get an object from this index
3452-
*
3453-
* @param objectID the unique identifier of the object to retrieve
3454-
* @param attrs (optional) if set, contains the array of attribute names to retrieve
3455-
* @param callback (optional) the result callback called with two arguments
3456-
* error: null or Error('message')
3457-
* content: the object to retrieve or the error message if a failure occured
3458-
*/
3459-
Index.prototype.getObject = function(objectID, attrs, callback) {
3460-
var indexObj = this;
3461-
3462-
if (arguments.length === 1 || typeof attrs === 'function') {
3463-
callback = attrs;
3464-
attrs = undefined;
3465-
}
3466-
3467-
var params = '';
3468-
if (attrs !== undefined) {
3469-
params = '?attributes=';
3470-
for (var i = 0; i < attrs.length; ++i) {
3471-
if (i !== 0) {
3472-
params += ',';
3473-
}
3474-
params += attrs[i];
3475-
}
3476-
}
3477-
3478-
return this.as._jsonRequest({
3479-
method: 'GET',
3480-
url: '/1/indexes/' + encodeURIComponent(indexObj.indexName) + '/' + encodeURIComponent(objectID) + params,
3481-
hostType: 'read',
3482-
callback: callback
3483-
});
3484-
};
3485-
3486-
/*
3487-
* Get several objects from this index
3488-
*
3489-
* @param objectIDs the array of unique identifier of objects to retrieve
3490-
*/
3491-
Index.prototype.getObjects = function(objectIDs, attributesToRetrieve, callback) {
3492-
var isArray = require(10);
3493-
var map = require(29);
3494-
3495-
var usage = 'Usage: index.getObjects(arrayOfObjectIDs[, callback])';
3496-
3497-
if (!isArray(objectIDs)) {
3498-
throw new Error(usage);
3499-
}
3500-
3501-
var indexObj = this;
3502-
3503-
if (arguments.length === 1 || typeof attributesToRetrieve === 'function') {
3504-
callback = attributesToRetrieve;
3505-
attributesToRetrieve = undefined;
3506-
}
3507-
3508-
var body = {
3509-
requests: map(objectIDs, function prepareRequest(objectID) {
3510-
var request = {
3511-
indexName: indexObj.indexName,
3512-
objectID: objectID
3513-
};
3514-
3515-
if (attributesToRetrieve) {
3516-
request.attributesToRetrieve = attributesToRetrieve.join(',');
3517-
}
3518-
3519-
return request;
3520-
})
3521-
};
3522-
3523-
return this.as._jsonRequest({
3524-
method: 'POST',
3525-
url: '/1/indexes/*/objects',
3526-
hostType: 'read',
3527-
body: body,
3528-
callback: callback
3529-
});
3530-
};
3531-
35323450
/*
35333451
* Update partially an object (only update attributes passed in argument)
35343452
*
@@ -4714,12 +4632,95 @@ IndexCore.prototype._search = function(params, url, callback) {
47144632
});
47154633
};
47164634

4635+
/*
4636+
* Get an object from this index
4637+
*
4638+
* @param objectID the unique identifier of the object to retrieve
4639+
* @param attrs (optional) if set, contains the array of attribute names to retrieve
4640+
* @param callback (optional) the result callback called with two arguments
4641+
* error: null or Error('message')
4642+
* content: the object to retrieve or the error message if a failure occured
4643+
*/
4644+
IndexCore.prototype.getObject = function(objectID, attrs, callback) {
4645+
var indexObj = this;
4646+
4647+
if (arguments.length === 1 || typeof attrs === 'function') {
4648+
callback = attrs;
4649+
attrs = undefined;
4650+
}
4651+
4652+
var params = '';
4653+
if (attrs !== undefined) {
4654+
params = '?attributes=';
4655+
for (var i = 0; i < attrs.length; ++i) {
4656+
if (i !== 0) {
4657+
params += ',';
4658+
}
4659+
params += attrs[i];
4660+
}
4661+
}
4662+
4663+
return this.as._jsonRequest({
4664+
method: 'GET',
4665+
url: '/1/indexes/' + encodeURIComponent(indexObj.indexName) + '/' + encodeURIComponent(objectID) + params,
4666+
hostType: 'read',
4667+
callback: callback
4668+
});
4669+
};
4670+
4671+
/*
4672+
* Get several objects from this index
4673+
*
4674+
* @param objectIDs the array of unique identifier of objects to retrieve
4675+
*/
4676+
IndexCore.prototype.getObjects = function(objectIDs, attributesToRetrieve, callback) {
4677+
var isArray = require(10);
4678+
var map = require(29);
4679+
4680+
var usage = 'Usage: index.getObjects(arrayOfObjectIDs[, callback])';
4681+
4682+
if (!isArray(objectIDs)) {
4683+
throw new Error(usage);
4684+
}
4685+
4686+
var indexObj = this;
4687+
4688+
if (arguments.length === 1 || typeof attributesToRetrieve === 'function') {
4689+
callback = attributesToRetrieve;
4690+
attributesToRetrieve = undefined;
4691+
}
4692+
4693+
var body = {
4694+
requests: map(objectIDs, function prepareRequest(objectID) {
4695+
var request = {
4696+
indexName: indexObj.indexName,
4697+
objectID: objectID
4698+
};
4699+
4700+
if (attributesToRetrieve) {
4701+
request.attributesToRetrieve = attributesToRetrieve.join(',');
4702+
}
4703+
4704+
return request;
4705+
})
4706+
};
4707+
4708+
return this.as._jsonRequest({
4709+
method: 'POST',
4710+
url: '/1/indexes/*/objects',
4711+
hostType: 'read',
4712+
body: body,
4713+
callback: callback
4714+
});
4715+
};
4716+
47174717
IndexCore.prototype.as = null;
47184718
IndexCore.prototype.indexName = null;
47194719
IndexCore.prototype.typeAheadArgs = null;
47204720
IndexCore.prototype.typeAheadValueOption = null;
47214721

4722-
},{"23":23,"30":30}],17:[function(require,module,exports){
4722+
},{"10":10,"23":23,"29":29,"30":30}],17:[function(require,module,exports){
4723+
(function (process){
47234724
'use strict';
47244725

47254726
// This is the AngularJS Algolia Search module
@@ -4739,7 +4740,7 @@ var places = require(31);
47394740
// expose original algoliasearch fn in window
47404741
window.algoliasearch = require(18);
47414742

4742-
if ("production" === 'development') {
4743+
if (process.env.NODE_ENV === 'debug') {
47434744
require(3).enable('algoliasearch*');
47444745
}
47454746

@@ -4925,7 +4926,8 @@ window.angular.module('algoliasearch', [])
49254926
};
49264927
}]);
49274928

4928-
},{"12":12,"18":18,"20":20,"21":21,"22":22,"24":24,"27":27,"3":3,"31":31,"32":32,"7":7,"9":9}],18:[function(require,module,exports){
4929+
}).call(this,require(2))
4930+
},{"12":12,"18":18,"2":2,"20":20,"21":21,"22":22,"24":24,"27":27,"3":3,"31":31,"32":32,"7":7,"9":9}],18:[function(require,module,exports){
49294931
'use strict';
49304932

49314933
var AlgoliaSearch = require(12);
@@ -4934,6 +4936,7 @@ var createAlgoliasearch = require(19);
49344936
module.exports = createAlgoliasearch(AlgoliaSearch);
49354937

49364938
},{"12":12,"19":19}],19:[function(require,module,exports){
4939+
(function (process){
49374940
'use strict';
49384941

49394942
var global = require(8);
@@ -4950,7 +4953,7 @@ module.exports = function createAlgoliasearch(AlgoliaSearch, uaSuffix) {
49504953
var places = require(31);
49514954
uaSuffix = uaSuffix || '';
49524955

4953-
if ("production" === 'development') {
4956+
if (process.env.NODE_ENV === 'debug') {
49544957
require(3).enable('algoliasearch*');
49554958
}
49564959

@@ -5154,7 +5157,8 @@ module.exports = function createAlgoliasearch(AlgoliaSearch, uaSuffix) {
51545157
return algoliasearch;
51555158
};
51565159

5157-
},{"20":20,"21":21,"22":22,"24":24,"27":27,"3":3,"31":31,"32":32,"5":5,"8":8,"9":9}],20:[function(require,module,exports){
5160+
}).call(this,require(2))
5161+
},{"2":2,"20":20,"21":21,"22":22,"24":24,"27":27,"3":3,"31":31,"32":32,"5":5,"8":8,"9":9}],20:[function(require,module,exports){
51585162
'use strict';
51595163

51605164
module.exports = getDocumentProtocol;
@@ -5549,6 +5553,6 @@ function createPlacesClient(algoliasearch) {
55495553
},{"23":23,"24":24}],32:[function(require,module,exports){
55505554
'use strict';
55515555

5552-
module.exports = '3.17.0';
5556+
module.exports = '3.18.0';
55535557

55545558
},{}]},{},[17]);

dist/algoliasearch.angular.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)