algoliasearch 5.0.0-alpha.3 → 5.0.0-alpha.6

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.
Files changed (126) hide show
  1. package/dist/algoliasearch/builds/browser.d.ts +15 -10
  2. package/dist/algoliasearch/builds/browser.d.ts.map +1 -1
  3. package/dist/algoliasearch/builds/node.d.ts +15 -10
  4. package/dist/algoliasearch/builds/node.d.ts.map +1 -1
  5. package/dist/algoliasearch/lite/model/acl.d.ts +3 -0
  6. package/dist/algoliasearch/lite/model/acl.d.ts.map +1 -1
  7. package/dist/algoliasearch/lite/model/addApiKeyResponse.d.ts +1 -1
  8. package/dist/algoliasearch/lite/model/attributeToUpdate.d.ts +3 -0
  9. package/dist/algoliasearch/lite/model/attributeToUpdate.d.ts.map +1 -0
  10. package/dist/algoliasearch/lite/model/baseBrowseResponse.d.ts +1 -1
  11. package/dist/algoliasearch/lite/model/baseBrowseResponse.d.ts.map +1 -1
  12. package/dist/algoliasearch/lite/model/baseGetApiKeyResponse.d.ts +11 -0
  13. package/dist/algoliasearch/lite/model/baseGetApiKeyResponse.d.ts.map +1 -0
  14. package/dist/algoliasearch/lite/model/baseSearchResponse.d.ts +1 -1
  15. package/dist/algoliasearch/lite/model/baseSearchResponse.d.ts.map +1 -1
  16. package/dist/algoliasearch/lite/model/getApiKeyResponse.d.ts +4 -0
  17. package/dist/algoliasearch/lite/model/getApiKeyResponse.d.ts.map +1 -0
  18. package/dist/algoliasearch/lite/model/index.d.ts +3 -3
  19. package/dist/algoliasearch/lite/model/index.d.ts.map +1 -1
  20. package/dist/algoliasearch/lite/model/indexSettingsAsSearchParams.d.ts +4 -0
  21. package/dist/algoliasearch/lite/model/indexSettingsAsSearchParams.d.ts.map +1 -1
  22. package/dist/algoliasearch/lite/src/liteClient.d.ts +9 -1
  23. package/dist/algoliasearch/lite/src/liteClient.d.ts.map +1 -1
  24. package/dist/algoliasearch.cjs.js +190 -29
  25. package/dist/algoliasearch.esm.browser.js +218 -57
  26. package/dist/algoliasearch.esm.node.js +191 -30
  27. package/dist/algoliasearch.umd.js +2 -2
  28. package/dist/builds/browser.d.ts +15 -10
  29. package/dist/builds/browser.d.ts.map +1 -1
  30. package/dist/builds/node.d.ts +15 -10
  31. package/dist/builds/node.d.ts.map +1 -1
  32. package/dist/client-abtesting/src/abtestingClient.d.ts +9 -1
  33. package/dist/client-abtesting/src/abtestingClient.d.ts.map +1 -1
  34. package/dist/client-analytics/src/analyticsClient.d.ts +9 -1
  35. package/dist/client-analytics/src/analyticsClient.d.ts.map +1 -1
  36. package/dist/client-personalization/src/personalizationClient.d.ts +9 -1
  37. package/dist/client-personalization/src/personalizationClient.d.ts.map +1 -1
  38. package/dist/client-search/model/acl.d.ts +3 -0
  39. package/dist/client-search/model/acl.d.ts.map +1 -1
  40. package/dist/client-search/model/addApiKeyResponse.d.ts +1 -1
  41. package/dist/client-search/model/attributeToUpdate.d.ts +3 -0
  42. package/dist/client-search/model/attributeToUpdate.d.ts.map +1 -0
  43. package/dist/client-search/model/baseBrowseResponse.d.ts +1 -1
  44. package/dist/client-search/model/baseBrowseResponse.d.ts.map +1 -1
  45. package/dist/client-search/model/baseGetApiKeyResponse.d.ts +11 -0
  46. package/dist/client-search/model/baseGetApiKeyResponse.d.ts.map +1 -0
  47. package/dist/client-search/model/baseSearchResponse.d.ts +1 -1
  48. package/dist/client-search/model/baseSearchResponse.d.ts.map +1 -1
  49. package/dist/client-search/model/batchParams.d.ts +1 -1
  50. package/dist/client-search/model/batchParams.d.ts.map +1 -1
  51. package/dist/client-search/model/clientMethodProps.d.ts +22 -11
  52. package/dist/client-search/model/clientMethodProps.d.ts.map +1 -1
  53. package/dist/client-search/model/getApiKeyResponse.d.ts +4 -0
  54. package/dist/client-search/model/getApiKeyResponse.d.ts.map +1 -0
  55. package/dist/client-search/model/getObjectsParams.d.ts +1 -1
  56. package/dist/client-search/model/getObjectsParams.d.ts.map +1 -1
  57. package/dist/client-search/model/index.d.ts +3 -3
  58. package/dist/client-search/model/index.d.ts.map +1 -1
  59. package/dist/client-search/model/indexSettingsAsSearchParams.d.ts +4 -0
  60. package/dist/client-search/model/indexSettingsAsSearchParams.d.ts.map +1 -1
  61. package/dist/client-search/model/listApiKeysResponse.d.ts +2 -2
  62. package/dist/client-search/model/listApiKeysResponse.d.ts.map +1 -1
  63. package/dist/client-search/model/multipleBatchRequest.d.ts +3 -3
  64. package/dist/client-search/model/multipleBatchRequest.d.ts.map +1 -1
  65. package/dist/client-search/model/multipleBatchResponse.d.ts +2 -2
  66. package/dist/client-search/model/multipleBatchResponse.d.ts.map +1 -1
  67. package/dist/client-search/model/updateApiKeyResponse.d.ts +1 -1
  68. package/dist/client-search/src/searchClient.d.ts +64 -17
  69. package/dist/client-search/src/searchClient.d.ts.map +1 -1
  70. package/dist/lite/builds/browser.d.ts +15 -10
  71. package/dist/lite/builds/browser.d.ts.map +1 -1
  72. package/dist/lite/builds/node.d.ts +15 -10
  73. package/dist/lite/builds/node.d.ts.map +1 -1
  74. package/dist/lite/lite/model/acl.d.ts +3 -0
  75. package/dist/lite/lite/model/acl.d.ts.map +1 -1
  76. package/dist/lite/lite/model/addApiKeyResponse.d.ts +1 -1
  77. package/dist/lite/lite/model/attributeToUpdate.d.ts +3 -0
  78. package/dist/lite/lite/model/attributeToUpdate.d.ts.map +1 -0
  79. package/dist/lite/lite/model/baseBrowseResponse.d.ts +1 -1
  80. package/dist/lite/lite/model/baseBrowseResponse.d.ts.map +1 -1
  81. package/dist/lite/lite/model/baseGetApiKeyResponse.d.ts +11 -0
  82. package/dist/lite/lite/model/baseGetApiKeyResponse.d.ts.map +1 -0
  83. package/dist/lite/lite/model/baseSearchResponse.d.ts +1 -1
  84. package/dist/lite/lite/model/baseSearchResponse.d.ts.map +1 -1
  85. package/dist/lite/lite/model/getApiKeyResponse.d.ts +4 -0
  86. package/dist/lite/lite/model/getApiKeyResponse.d.ts.map +1 -0
  87. package/dist/lite/lite/model/index.d.ts +3 -3
  88. package/dist/lite/lite/model/index.d.ts.map +1 -1
  89. package/dist/lite/lite/model/indexSettingsAsSearchParams.d.ts +4 -0
  90. package/dist/lite/lite/model/indexSettingsAsSearchParams.d.ts.map +1 -1
  91. package/dist/lite/lite/src/liteClient.d.ts +9 -1
  92. package/dist/lite/lite/src/liteClient.d.ts.map +1 -1
  93. package/dist/lite/lite.cjs.js +14 -1
  94. package/dist/lite/lite.esm.browser.js +14 -1
  95. package/dist/lite/lite.esm.node.js +14 -1
  96. package/dist/lite/lite.umd.js +2 -2
  97. package/lite/model/acl.ts +3 -0
  98. package/lite/model/addApiKeyResponse.ts +1 -1
  99. package/lite/model/{attributeOrBuiltInOperation.ts → attributeToUpdate.ts} +1 -1
  100. package/lite/model/baseBrowseResponse.ts +1 -1
  101. package/lite/model/baseGetApiKeyResponse.ts +13 -0
  102. package/lite/model/baseSearchResponse.ts +1 -1
  103. package/lite/model/{key.ts → getApiKeyResponse.ts} +2 -2
  104. package/lite/model/index.ts +3 -3
  105. package/lite/model/indexSettingsAsSearchParams.ts +5 -0
  106. package/lite/src/liteClient.ts +19 -1
  107. package/package.json +9 -9
  108. package/dist/algoliasearch/lite/model/attributeOrBuiltInOperation.d.ts +0 -3
  109. package/dist/algoliasearch/lite/model/attributeOrBuiltInOperation.d.ts.map +0 -1
  110. package/dist/algoliasearch/lite/model/createdAtObject.d.ts +0 -7
  111. package/dist/algoliasearch/lite/model/createdAtObject.d.ts.map +0 -1
  112. package/dist/algoliasearch/lite/model/key.d.ts +0 -4
  113. package/dist/algoliasearch/lite/model/key.d.ts.map +0 -1
  114. package/dist/client-search/model/attributeOrBuiltInOperation.d.ts +0 -3
  115. package/dist/client-search/model/attributeOrBuiltInOperation.d.ts.map +0 -1
  116. package/dist/client-search/model/createdAtObject.d.ts +0 -7
  117. package/dist/client-search/model/createdAtObject.d.ts.map +0 -1
  118. package/dist/client-search/model/key.d.ts +0 -4
  119. package/dist/client-search/model/key.d.ts.map +0 -1
  120. package/dist/lite/lite/model/attributeOrBuiltInOperation.d.ts +0 -3
  121. package/dist/lite/lite/model/attributeOrBuiltInOperation.d.ts.map +0 -1
  122. package/dist/lite/lite/model/createdAtObject.d.ts +0 -7
  123. package/dist/lite/lite/model/createdAtObject.d.ts.map +0 -1
  124. package/dist/lite/lite/model/key.d.ts +0 -4
  125. package/dist/lite/lite/model/key.d.ts.map +0 -1
  126. package/lite/model/createdAtObject.ts +0 -8
@@ -1,8 +1,8 @@
1
- import { createAuth, createTransporter, getAlgoliaAgent, createRetryablePromise, shuffle, DEFAULT_CONNECT_TIMEOUT_NODE, DEFAULT_READ_TIMEOUT_NODE, DEFAULT_WRITE_TIMEOUT_NODE, createNullCache, createMemoryCache } from '@algolia/client-common';
1
+ import { createAuth, createTransporter, getAlgoliaAgent, createIterablePromise, shuffle, DEFAULT_CONNECT_TIMEOUT_NODE, DEFAULT_READ_TIMEOUT_NODE, DEFAULT_WRITE_TIMEOUT_NODE, createNullCache, createMemoryCache } from '@algolia/client-common';
2
2
  import { createHttpRequester } from '@algolia/requester-node-http';
3
3
 
4
4
  // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
5
- const apiClientVersion$4 = '5.0.0-alpha.3';
5
+ const apiClientVersion$4 = '5.0.0-alpha.6';
6
6
  const REGIONS$2 = ['de', 'us'];
7
7
  function getDefaultHosts$3(region) {
8
8
  const url = !region
@@ -33,6 +33,19 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
33
33
  });
34
34
  return {
35
35
  transporter,
36
+ /**
37
+ * The `appId` currently in use.
38
+ */
39
+ appId: appIdOption,
40
+ /**
41
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
42
+ */
43
+ clearCache() {
44
+ return Promise.all([
45
+ transporter.requestsCache.clear(),
46
+ transporter.responsesCache.clear(),
47
+ ]).then(() => undefined);
48
+ },
36
49
  /**
37
50
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
38
51
  */
@@ -280,7 +293,7 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
280
293
  }
281
294
 
282
295
  // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
283
- const apiClientVersion$3 = '5.0.0-alpha.3';
296
+ const apiClientVersion$3 = '5.0.0-alpha.6';
284
297
  const REGIONS$1 = ['de', 'us'];
285
298
  function getDefaultHosts$2(region) {
286
299
  const url = !region
@@ -311,6 +324,19 @@ function createAnalyticsClient({ appId: appIdOption, apiKey: apiKeyOption, authM
311
324
  });
312
325
  return {
313
326
  transporter,
327
+ /**
328
+ * The `appId` currently in use.
329
+ */
330
+ appId: appIdOption,
331
+ /**
332
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
333
+ */
334
+ clearCache() {
335
+ return Promise.all([
336
+ transporter.requestsCache.clear(),
337
+ transporter.responsesCache.clear(),
338
+ ]).then(() => undefined);
339
+ },
314
340
  /**
315
341
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
316
342
  */
@@ -1164,7 +1190,7 @@ function createAnalyticsClient({ appId: appIdOption, apiKey: apiKeyOption, authM
1164
1190
  }
1165
1191
 
1166
1192
  // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
1167
- const apiClientVersion$2 = '5.0.0-alpha.3';
1193
+ const apiClientVersion$2 = '5.0.0-alpha.6';
1168
1194
  const REGIONS = ['eu', 'us'];
1169
1195
  function getDefaultHosts$1(region) {
1170
1196
  const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
@@ -1193,6 +1219,19 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
1193
1219
  });
1194
1220
  return {
1195
1221
  transporter,
1222
+ /**
1223
+ * The `appId` currently in use.
1224
+ */
1225
+ appId: appIdOption,
1226
+ /**
1227
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
1228
+ */
1229
+ clearCache() {
1230
+ return Promise.all([
1231
+ transporter.requestsCache.clear(),
1232
+ transporter.responsesCache.clear(),
1233
+ ]).then(() => undefined);
1234
+ },
1196
1235
  /**
1197
1236
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
1198
1237
  */
@@ -1408,7 +1447,7 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
1408
1447
  }
1409
1448
 
1410
1449
  // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
1411
- const apiClientVersion$1 = '5.0.0-alpha.3';
1450
+ const apiClientVersion$1 = '5.0.0-alpha.6';
1412
1451
  function getDefaultHosts(appId) {
1413
1452
  return [
1414
1453
  {
@@ -1462,6 +1501,19 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1462
1501
  });
1463
1502
  return {
1464
1503
  transporter,
1504
+ /**
1505
+ * The `appId` currently in use.
1506
+ */
1507
+ appId: appIdOption,
1508
+ /**
1509
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
1510
+ */
1511
+ clearCache() {
1512
+ return Promise.all([
1513
+ transporter.requestsCache.clear(),
1514
+ transporter.responsesCache.clear(),
1515
+ ]).then(() => undefined);
1516
+ },
1465
1517
  /**
1466
1518
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
1467
1519
  */
@@ -1478,38 +1530,57 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1478
1530
  transporter.algoliaAgent.add({ segment, version });
1479
1531
  },
1480
1532
  /**
1481
- * Helper: Wait for a task to complete with `indexName` and `taskID`.
1533
+ * Helper: Wait for a task to be published (completed) for a given `indexName` and `taskID`.
1482
1534
  *
1483
- * @summary Wait for a task to complete.
1535
+ * @summary Helper method that waits for a task to be published (completed).
1484
1536
  * @param waitForTaskOptions - The waitForTaskOptions object.
1485
1537
  * @param waitForTaskOptions.indexName - The `indexName` where the operation was performed.
1486
1538
  * @param waitForTaskOptions.taskID - The `taskID` returned in the method response.
1539
+ * @param waitForTaskOptions.maxRetries - The maximum number of retries. 50 by default.
1540
+ * @param waitForTaskOptions.timeout - The function to decide how long to wait between retries.
1487
1541
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
1488
1542
  */
1489
- waitForTask({ indexName, taskID, ...createRetryablePromiseOptions }, requestOptions) {
1490
- return createRetryablePromise({
1491
- ...createRetryablePromiseOptions,
1543
+ waitForTask({ indexName, taskID, maxRetries = 50, timeout = (retryCount) => Math.min(retryCount * 200, 5000), }, requestOptions) {
1544
+ let retryCount = 0;
1545
+ return createIterablePromise({
1492
1546
  func: () => this.getTask({ indexName, taskID }, requestOptions),
1493
1547
  validate: (response) => response.status === 'published',
1548
+ aggregator: () => (retryCount += 1),
1549
+ error: {
1550
+ validate: () => retryCount >= maxRetries,
1551
+ message: () => `The maximum number of retries exceeded. (${retryCount}/${maxRetries})`,
1552
+ },
1553
+ timeout: () => timeout(retryCount),
1494
1554
  });
1495
1555
  },
1496
1556
  /**
1497
1557
  * Helper: Wait for an API key to be added, updated or deleted based on a given `operation`.
1498
1558
  *
1499
- * @summary Wait for an API key task to be processed.
1559
+ * @summary Helper method that waits for an API key task to be processed.
1500
1560
  * @param waitForApiKeyOptions - The waitForApiKeyOptions object.
1501
1561
  * @param waitForApiKeyOptions.operation - The `operation` that was done on a `key`.
1502
1562
  * @param waitForApiKeyOptions.key - The `key` that has been added, deleted or updated.
1503
1563
  * @param waitForApiKeyOptions.apiKey - Necessary to know if an `update` operation has been processed, compare fields of the response with it.
1564
+ * @param waitForApiKeyOptions.maxRetries - The maximum number of retries. 50 by default.
1565
+ * @param waitForApiKeyOptions.timeout - The function to decide how long to wait between retries.
1504
1566
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getApikey` method and merged with the transporter requestOptions.
1505
1567
  */
1506
- waitForApiKey({ operation, key, apiKey, ...createRetryablePromiseOptions }, requestOptions) {
1568
+ waitForApiKey({ operation, key, apiKey, maxRetries = 50, timeout = (retryCount) => Math.min(retryCount * 200, 5000), }, requestOptions) {
1569
+ let retryCount = 0;
1570
+ const baseIteratorOptions = {
1571
+ aggregator: () => (retryCount += 1),
1572
+ error: {
1573
+ validate: () => retryCount >= maxRetries,
1574
+ message: () => `The maximum number of retries exceeded. (${retryCount}/${maxRetries})`,
1575
+ },
1576
+ timeout: () => timeout(retryCount),
1577
+ };
1507
1578
  if (operation === 'update') {
1508
1579
  if (!apiKey) {
1509
1580
  throw new Error('`apiKey` is required when waiting for an `update` operation.');
1510
1581
  }
1511
- return createRetryablePromise({
1512
- ...createRetryablePromiseOptions,
1582
+ return createIterablePromise({
1583
+ ...baseIteratorOptions,
1513
1584
  func: () => this.getApiKey({ key }, requestOptions),
1514
1585
  validate: (response) => {
1515
1586
  for (const field of Object.keys(apiKey)) {
@@ -1527,12 +1598,99 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1527
1598
  },
1528
1599
  });
1529
1600
  }
1530
- return createRetryablePromise({
1531
- ...createRetryablePromiseOptions,
1601
+ return createIterablePromise({
1602
+ ...baseIteratorOptions,
1532
1603
  func: () => this.getApiKey({ key }, requestOptions).catch((error) => error),
1533
1604
  validate: (error) => operation === 'add' ? error.status !== 404 : error.status === 404,
1534
1605
  });
1535
1606
  },
1607
+ /**
1608
+ * Helper: Iterate on the `browse` method of the client to allow aggregating objects of an index.
1609
+ *
1610
+ * @summary Helper method that iterates on the `browse` method.
1611
+ * @param browseObjects - The browseObjects object.
1612
+ * @param browseObjects.indexName - The index in which to perform the request.
1613
+ * @param browseObjects.browseRequest - The `browse` method parameters.
1614
+ * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is no `cursor` in the response.
1615
+ * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
1616
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `browse` method and merged with the transporter requestOptions.
1617
+ */
1618
+ browseObjects({ indexName, browseRequest, ...browseObjectsOptions }, requestOptions) {
1619
+ return createIterablePromise({
1620
+ func: (previousResponse) => {
1621
+ return this.browse({
1622
+ indexName,
1623
+ browseRequest: {
1624
+ cursor: previousResponse ? previousResponse.cursor : undefined,
1625
+ ...browseRequest,
1626
+ },
1627
+ }, requestOptions);
1628
+ },
1629
+ validate: (response) => response.cursor === undefined,
1630
+ ...browseObjectsOptions,
1631
+ });
1632
+ },
1633
+ /**
1634
+ * Helper: Iterate on the `searchRules` method of the client to allow aggregating rules of an index.
1635
+ *
1636
+ * @summary Helper method that iterates on the `searchRules` method.
1637
+ * @param browseObjects - The browseObjects object.
1638
+ * @param browseObjects.indexName - The index in which to perform the request.
1639
+ * @param browseObjects.searchRulesParams - The `searchRules` method parameters.
1640
+ * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000).
1641
+ * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
1642
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchRules` method and merged with the transporter requestOptions.
1643
+ */
1644
+ browseRules({ indexName, searchRulesParams, ...browseRulesOptions }, requestOptions) {
1645
+ const params = {
1646
+ hitsPerPage: 1000,
1647
+ ...searchRulesParams,
1648
+ };
1649
+ return createIterablePromise({
1650
+ func: (previousResponse) => {
1651
+ return this.searchRules({
1652
+ indexName,
1653
+ searchRulesParams: {
1654
+ ...params,
1655
+ page: previousResponse
1656
+ ? previousResponse.page + 1
1657
+ : params.page || 0,
1658
+ },
1659
+ }, requestOptions);
1660
+ },
1661
+ validate: (response) => response.nbHits < params.hitsPerPage,
1662
+ ...browseRulesOptions,
1663
+ });
1664
+ },
1665
+ /**
1666
+ * Helper: Iterate on the `searchSynonyms` method of the client to allow aggregating rules of an index.
1667
+ *
1668
+ * @summary Helper method that iterates on the `searchSynonyms` method.
1669
+ * @param browseObjects - The browseObjects object.
1670
+ * @param browseObjects.indexName - The index in which to perform the request.
1671
+ * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000).
1672
+ * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
1673
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchSynonyms` method and merged with the transporter requestOptions.
1674
+ */
1675
+ browseSynonyms({ indexName, validate, aggregator, ...browseSynonymsOptions }, requestOptions) {
1676
+ const params = {
1677
+ hitsPerPage: 1000,
1678
+ ...browseSynonymsOptions,
1679
+ };
1680
+ return createIterablePromise({
1681
+ func: (previousResponse) => {
1682
+ return this.searchSynonyms({
1683
+ ...params,
1684
+ indexName,
1685
+ page: previousResponse
1686
+ ? previousResponse.page + 1
1687
+ : browseSynonymsOptions.page || 0,
1688
+ }, requestOptions);
1689
+ },
1690
+ validate: (response) => response.nbHits < params.hitsPerPage,
1691
+ ...browseSynonymsOptions,
1692
+ });
1693
+ },
1536
1694
  /**
1537
1695
  * Add a new API Key with specific permissions/restrictions.
1538
1696
  *
@@ -2226,6 +2384,9 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
2226
2384
  if (!getObjectsParams) {
2227
2385
  throw new Error('Parameter `getObjectsParams` is required when calling `getObjects`.');
2228
2386
  }
2387
+ if (!getObjectsParams.requests) {
2388
+ throw new Error('Parameter `getObjectsParams.requests` is required when calling `getObjects`.');
2389
+ }
2229
2390
  const requestPath = '/1/indexes/*/objects';
2230
2391
  const headers = {};
2231
2392
  const queryParameters = {};
@@ -2529,6 +2690,9 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
2529
2690
  if (!batchParams) {
2530
2691
  throw new Error('Parameter `batchParams` is required when calling `multipleBatch`.');
2531
2692
  }
2693
+ if (!batchParams.requests) {
2694
+ throw new Error('Parameter `batchParams.requests` is required when calling `multipleBatch`.');
2695
+ }
2532
2696
  const requestPath = '/1/indexes/*/batch';
2533
2697
  const headers = {};
2534
2698
  const queryParameters = {};
@@ -2582,19 +2746,19 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
2582
2746
  * @param partialUpdateObject - The partialUpdateObject object.
2583
2747
  * @param partialUpdateObject.indexName - The index in which to perform the request.
2584
2748
  * @param partialUpdateObject.objectID - Unique identifier of an object.
2585
- * @param partialUpdateObject.attributeOrBuiltInOperation - List of attributes to update.
2749
+ * @param partialUpdateObject.attributesToUpdate - Map of attribute(s) to update.
2586
2750
  * @param partialUpdateObject.createIfNotExists - Creates the record if it does not exist yet.
2587
2751
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2588
2752
  */
2589
- partialUpdateObject({ indexName, objectID, attributeOrBuiltInOperation, createIfNotExists, }, requestOptions) {
2753
+ partialUpdateObject({ indexName, objectID, attributesToUpdate, createIfNotExists, }, requestOptions) {
2590
2754
  if (!indexName) {
2591
2755
  throw new Error('Parameter `indexName` is required when calling `partialUpdateObject`.');
2592
2756
  }
2593
2757
  if (!objectID) {
2594
2758
  throw new Error('Parameter `objectID` is required when calling `partialUpdateObject`.');
2595
2759
  }
2596
- if (!attributeOrBuiltInOperation) {
2597
- throw new Error('Parameter `attributeOrBuiltInOperation` is required when calling `partialUpdateObject`.');
2760
+ if (!attributesToUpdate) {
2761
+ throw new Error('Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.');
2598
2762
  }
2599
2763
  const requestPath = '/1/indexes/{indexName}/{objectID}/partial'
2600
2764
  .replace('{indexName}', encodeURIComponent(indexName))
@@ -2609,7 +2773,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
2609
2773
  path: requestPath,
2610
2774
  queryParameters,
2611
2775
  headers,
2612
- data: attributeOrBuiltInOperation,
2776
+ data: attributesToUpdate,
2613
2777
  };
2614
2778
  return transporter.request(request, requestOptions);
2615
2779
  },
@@ -2810,17 +2974,17 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
2810
2974
  * @summary Save a batch of rules.
2811
2975
  * @param saveRules - The saveRules object.
2812
2976
  * @param saveRules.indexName - The index in which to perform the request.
2813
- * @param saveRules.rule - The rule object.
2977
+ * @param saveRules.rules - The rules object.
2814
2978
  * @param saveRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName.
2815
2979
  * @param saveRules.clearExistingRules - When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept.
2816
2980
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2817
2981
  */
2818
- saveRules({ indexName, rule, forwardToReplicas, clearExistingRules, }, requestOptions) {
2982
+ saveRules({ indexName, rules, forwardToReplicas, clearExistingRules, }, requestOptions) {
2819
2983
  if (!indexName) {
2820
2984
  throw new Error('Parameter `indexName` is required when calling `saveRules`.');
2821
2985
  }
2822
- if (!rule) {
2823
- throw new Error('Parameter `rule` is required when calling `saveRules`.');
2986
+ if (!rules) {
2987
+ throw new Error('Parameter `rules` is required when calling `saveRules`.');
2824
2988
  }
2825
2989
  const requestPath = '/1/indexes/{indexName}/rules/batch'.replace('{indexName}', encodeURIComponent(indexName));
2826
2990
  const headers = {};
@@ -2836,7 +3000,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
2836
3000
  path: requestPath,
2837
3001
  queryParameters,
2838
3002
  headers,
2839
- data: rule,
3003
+ data: rules,
2840
3004
  };
2841
3005
  return transporter.request(request, requestOptions);
2842
3006
  },
@@ -3047,9 +3211,6 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
3047
3211
  if (!indexName) {
3048
3212
  throw new Error('Parameter `indexName` is required when calling `searchRules`.');
3049
3213
  }
3050
- if (!searchRulesParams) {
3051
- throw new Error('Parameter `searchRulesParams` is required when calling `searchRules`.');
3052
- }
3053
3214
  const requestPath = '/1/indexes/{indexName}/rules/search'.replace('{indexName}', encodeURIComponent(indexName));
3054
3215
  const headers = {};
3055
3216
  const queryParameters = {};
@@ -3058,7 +3219,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
3058
3219
  path: requestPath,
3059
3220
  queryParameters,
3060
3221
  headers,
3061
- data: searchRulesParams,
3222
+ data: searchRulesParams ? searchRulesParams : {},
3062
3223
  useReadTransporter: true,
3063
3224
  cacheable: true,
3064
3225
  };