algoliasearch 3.27.0 → 3.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/Index.js CHANGED
@@ -799,6 +799,7 @@ Index.prototype.searchRules = function(params, callback) {
799
799
  * Retrieve all the query rules in an index
800
800
  * @param [number=100] hitsPerPage The amount of query rules to retrieve per batch
801
801
  * @param [function] callback will be called after all query rules are retrieved
802
+ * error: null or Error('message')
802
803
  */
803
804
  Index.prototype.exportRules = function(hitsPerPage, callback) {
804
805
  return exportData(this.searchRules.bind(this), hitsPerPage, callback);
@@ -812,6 +813,10 @@ Index.prototype.saveRule = function(rule, opts, callback) {
812
813
  opts = {};
813
814
  }
814
815
 
816
+ if (!rule.objectID) {
817
+ throw new errors.AlgoliaSearchError('Missing or empty objectID field for rule');
818
+ }
819
+
815
820
  var forwardToReplicas = opts.forwardToReplicas === true ? 'true' : 'false';
816
821
 
817
822
  return this.as._jsonRequest({
@@ -984,11 +989,11 @@ Index.prototype.setSettings = function(settings, opts, callback) {
984
989
  };
985
990
 
986
991
  /*
987
- @deprecated see index.listApiKeys
988
- */
992
+ * @deprecated see client.listApiKeys()
993
+ */
989
994
  Index.prototype.listUserKeys = deprecate(function(callback) {
990
995
  return this.listApiKeys(callback);
991
- }, deprecatedMessage('index.listUserKeys()', 'index.listApiKeys()'));
996
+ }, deprecatedMessage('index.listUserKeys()', 'client.listApiKeys()'));
992
997
 
993
998
  /*
994
999
  * List all existing API keys to this index
@@ -996,8 +1001,10 @@ Index.prototype.listUserKeys = deprecate(function(callback) {
996
1001
  * @param callback the result callback called with two arguments
997
1002
  * error: null or Error('message')
998
1003
  * content: the server answer with API keys belonging to the index
1004
+ *
1005
+ * @deprecated see client.listApiKeys()
999
1006
  */
1000
- Index.prototype.listApiKeys = function(callback) {
1007
+ Index.prototype.listApiKeys = deprecate(function(callback) {
1001
1008
  var indexObj = this;
1002
1009
  return this.as._jsonRequest({
1003
1010
  method: 'GET',
@@ -1005,14 +1012,14 @@ Index.prototype.listApiKeys = function(callback) {
1005
1012
  hostType: 'read',
1006
1013
  callback: callback
1007
1014
  });
1008
- };
1015
+ }, deprecatedMessage('index.listApiKeys()', 'client.listApiKeys()'));
1009
1016
 
1010
1017
  /*
1011
- @deprecated see index.getApiKey
1012
- */
1018
+ * @deprecated see client.getApiKey()
1019
+ */
1013
1020
  Index.prototype.getUserKeyACL = deprecate(function(key, callback) {
1014
1021
  return this.getApiKey(key, callback);
1015
- }, deprecatedMessage('index.getUserKeyACL()', 'index.getApiKey()'));
1022
+ }, deprecatedMessage('index.getUserKeyACL()', 'client.getApiKey()'));
1016
1023
 
1017
1024
 
1018
1025
  /*
@@ -1022,8 +1029,10 @@ Index.prototype.getUserKeyACL = deprecate(function(key, callback) {
1022
1029
  * @param callback the result callback called with two arguments
1023
1030
  * error: null or Error('message')
1024
1031
  * content: the server answer with the right API key
1032
+ *
1033
+ * @deprecated see client.getApiKey()
1025
1034
  */
1026
- Index.prototype.getApiKey = function(key, callback) {
1035
+ Index.prototype.getApiKey = deprecate(function(key, callback) {
1027
1036
  var indexObj = this;
1028
1037
  return this.as._jsonRequest({
1029
1038
  method: 'GET',
@@ -1031,14 +1040,14 @@ Index.prototype.getApiKey = function(key, callback) {
1031
1040
  hostType: 'read',
1032
1041
  callback: callback
1033
1042
  });
1034
- };
1043
+ }, deprecatedMessage('index.getApiKey()', 'client.getApiKey()'));
1035
1044
 
1036
1045
  /*
1037
- @deprecated see index.deleteApiKey
1038
- */
1046
+ * @deprecated see client.deleteApiKey()
1047
+ */
1039
1048
  Index.prototype.deleteUserKey = deprecate(function(key, callback) {
1040
1049
  return this.deleteApiKey(key, callback);
1041
- }, deprecatedMessage('index.deleteUserKey()', 'index.deleteApiKey()'));
1050
+ }, deprecatedMessage('index.deleteUserKey()', 'client.deleteApiKey()'));
1042
1051
 
1043
1052
  /*
1044
1053
  * Delete an existing API key associated to this index
@@ -1047,8 +1056,10 @@ Index.prototype.deleteUserKey = deprecate(function(key, callback) {
1047
1056
  * @param callback the result callback called with two arguments
1048
1057
  * error: null or Error('message')
1049
1058
  * content: the server answer with the deletion date
1059
+ *
1060
+ * @deprecated see client.deleteApiKey()
1050
1061
  */
1051
- Index.prototype.deleteApiKey = function(key, callback) {
1062
+ Index.prototype.deleteApiKey = deprecate(function(key, callback) {
1052
1063
  var indexObj = this;
1053
1064
  return this.as._jsonRequest({
1054
1065
  method: 'DELETE',
@@ -1056,14 +1067,14 @@ Index.prototype.deleteApiKey = function(key, callback) {
1056
1067
  hostType: 'write',
1057
1068
  callback: callback
1058
1069
  });
1059
- };
1070
+ }, deprecatedMessage('index.deleteApiKey()', 'client.deleteApiKey()'));
1060
1071
 
1061
1072
  /*
1062
- @deprecated see index.addApiKey
1063
- */
1073
+ * @deprecated see client.addApiKey()
1074
+ */
1064
1075
  Index.prototype.addUserKey = deprecate(function(acls, params, callback) {
1065
1076
  return this.addApiKey(acls, params, callback);
1066
- }, deprecatedMessage('index.addUserKey()', 'index.addApiKey()'));
1077
+ }, deprecatedMessage('index.addUserKey()', 'client.addApiKey()'));
1067
1078
 
1068
1079
  /*
1069
1080
  * Add a new API key to this index
@@ -1100,8 +1111,10 @@ Index.prototype.addUserKey = deprecate(function(acls, params, callback) {
1100
1111
  * }
1101
1112
  * })
1102
1113
  * @see {@link https://www.algolia.com/doc/rest_api#AddIndexKey|Algolia REST API Documentation}
1114
+ *
1115
+ * @deprecated see client.addApiKey()
1103
1116
  */
1104
- Index.prototype.addApiKey = function(acls, params, callback) {
1117
+ Index.prototype.addApiKey = deprecate(function(acls, params, callback) {
1105
1118
  var isArray = require('isarray');
1106
1119
  var usage = 'Usage: index.addApiKey(arrayOfAcls[, params, callback])';
1107
1120
 
@@ -1138,21 +1151,21 @@ Index.prototype.addApiKey = function(acls, params, callback) {
1138
1151
  hostType: 'write',
1139
1152
  callback: callback
1140
1153
  });
1141
- };
1154
+ }, deprecatedMessage('index.addApiKey()', 'client.addApiKey()'));
1142
1155
 
1143
1156
  /**
1144
- * @deprecated use index.addApiKey()
1157
+ * @deprecated use client.addApiKey()
1145
1158
  */
1146
1159
  Index.prototype.addUserKeyWithValidity = deprecate(function deprecatedAddUserKeyWithValidity(acls, params, callback) {
1147
1160
  return this.addApiKey(acls, params, callback);
1148
- }, deprecatedMessage('index.addUserKeyWithValidity()', 'index.addApiKey()'));
1161
+ }, deprecatedMessage('index.addUserKeyWithValidity()', 'client.addApiKey()'));
1149
1162
 
1150
1163
  /*
1151
- @deprecated see index.updateApiKey
1152
- */
1164
+ * @deprecated see client.updateApiKey()
1165
+ */
1153
1166
  Index.prototype.updateUserKey = deprecate(function(key, acls, params, callback) {
1154
1167
  return this.updateApiKey(key, acls, params, callback);
1155
- }, deprecatedMessage('index.updateUserKey()', 'index.updateApiKey()'));
1168
+ }, deprecatedMessage('index.updateUserKey()', 'client.updateApiKey()'));
1156
1169
 
1157
1170
  /**
1158
1171
  * Update an existing API key of this index
@@ -1189,8 +1202,10 @@ Index.prototype.updateUserKey = deprecate(function(key, acls, params, callback)
1189
1202
  * }
1190
1203
  * })
1191
1204
  * @see {@link https://www.algolia.com/doc/rest_api#UpdateIndexKey|Algolia REST API Documentation}
1205
+ *
1206
+ * @deprecated see client.updateApiKey()
1192
1207
  */
1193
- Index.prototype.updateApiKey = function(key, acls, params, callback) {
1208
+ Index.prototype.updateApiKey = deprecate(function(key, acls, params, callback) {
1194
1209
  var isArray = require('isarray');
1195
1210
  var usage = 'Usage: index.updateApiKey(key, arrayOfAcls[, params, callback])';
1196
1211
 
@@ -1227,4 +1242,4 @@ Index.prototype.updateApiKey = function(key, acls, params, callback) {
1227
1242
  hostType: 'write',
1228
1243
  callback: callback
1229
1244
  });
1230
- };
1245
+ }, deprecatedMessage('index.updateApiKey()', 'client.updateApiKey()'));
@@ -185,6 +185,9 @@ window.angular.module('algoliasearch', [])
185
185
  $timeout(resolve, ms);
186
186
 
187
187
  return deferred.promise;
188
+ },
189
+ all: function(promises) {
190
+ return $q.all(promises);
188
191
  }
189
192
  };
190
193
 
@@ -140,5 +140,8 @@ AlgoliaSearchJQuery.prototype._promise = {
140
140
  deferred.resolve();
141
141
  }, ms);
142
142
  }).promise();
143
+ },
144
+ all: function all(promises) {
145
+ return $.when.apply(null, promises);
143
146
  }
144
147
  };
@@ -206,6 +206,9 @@ module.exports = function createAlgoliasearch(AlgoliaSearch, uaSuffix) {
206
206
  return new Promise(function resolveOnTimeout(resolve/* , reject*/) {
207
207
  setTimeout(resolve, ms);
208
208
  });
209
+ },
210
+ all: function all(promises) {
211
+ return Promise.all(promises);
209
212
  }
210
213
  };
211
214
 
@@ -168,5 +168,8 @@ AlgoliaSearchReactNative.prototype._promise = {
168
168
  return new Promise(function resolveOnTimeout(resolve/* , reject*/) {
169
169
  setTimeout(resolve, ms);
170
170
  });
171
+ },
172
+ all: function all(promises) {
173
+ return Promise.all(promises);
171
174
  }
172
175
  };
@@ -257,6 +257,9 @@ AlgoliaSearchNodeJS.prototype._promise = {
257
257
  return new Promise(function resolveOnTimeout(resolve/* , reject */) {
258
258
  setTimeout(resolve, ms);
259
259
  });
260
+ },
261
+ all: function all(promises) {
262
+ return Promise.all(promises);
260
263
  }
261
264
  };
262
265
 
@@ -116,6 +116,9 @@ AlgoliaSearchParse.prototype._promise = {
116
116
  _setTimeout(promise.resolve.bind(promise), ms);
117
117
 
118
118
  return promise;
119
+ },
120
+ all: function all(promises) {
121
+ return Parse.Promise.all(promises);
119
122
  }
120
123
  };
121
124
 
package/src/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  'use strict';
2
2
 
3
- module.exports = '3.27.0';
3
+ module.exports = '3.27.1';