@algolia/client-search 4.17.0 → 4.17.2

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.
@@ -587,11 +587,21 @@ const updateApiKey = (base) => {
587
587
  'maxQueriesPerIPPerHour',
588
588
  'maxHitsPerQuery',
589
589
  ];
590
+ // Check that all the fields retrieved through getApiKey are the same as the ones we wanted to update
590
591
  const hasChanged = (getApiKeyResponse) => {
591
592
  return Object.keys(updatedFields)
592
593
  .filter((updatedField) => apiKeyFields.indexOf(updatedField) !== -1)
593
594
  .every(updatedField => {
594
- return getApiKeyResponse[updatedField] === updatedFields[updatedField];
595
+ // If the field is an array, we need to check that they are the same length and that all the values are the same
596
+ if (Array.isArray(getApiKeyResponse[updatedField]) &&
597
+ Array.isArray(updatedFields[updatedField])) {
598
+ const getApiKeyResponseArray = getApiKeyResponse[updatedField];
599
+ return (getApiKeyResponseArray.length === updatedFields[updatedField].length &&
600
+ getApiKeyResponseArray.every((value, index) => value === updatedFields[updatedField][index]));
601
+ }
602
+ else {
603
+ return getApiKeyResponse[updatedField] === updatedFields[updatedField];
604
+ }
595
605
  });
596
606
  };
597
607
  const wait = (_, waitRequestOptions) => clientCommon.createRetryablePromise(retry => {
@@ -1618,7 +1618,7 @@ export declare type SearchOptions = {
1618
1618
  */
1619
1619
  readonly restrictSearchableAttributes?: readonly string[];
1620
1620
  /**
1621
- * Restricts a given query to look in only a subset of your searchable attributes.
1621
+ * Controls how facet values are sorted.
1622
1622
  */
1623
1623
  readonly sortFacetValuesBy?: 'count' | 'alpha';
1624
1624
  /**
@@ -583,11 +583,21 @@ const updateApiKey = (base) => {
583
583
  'maxQueriesPerIPPerHour',
584
584
  'maxHitsPerQuery',
585
585
  ];
586
+ // Check that all the fields retrieved through getApiKey are the same as the ones we wanted to update
586
587
  const hasChanged = (getApiKeyResponse) => {
587
588
  return Object.keys(updatedFields)
588
589
  .filter((updatedField) => apiKeyFields.indexOf(updatedField) !== -1)
589
590
  .every(updatedField => {
590
- return getApiKeyResponse[updatedField] === updatedFields[updatedField];
591
+ // If the field is an array, we need to check that they are the same length and that all the values are the same
592
+ if (Array.isArray(getApiKeyResponse[updatedField]) &&
593
+ Array.isArray(updatedFields[updatedField])) {
594
+ const getApiKeyResponseArray = getApiKeyResponse[updatedField];
595
+ return (getApiKeyResponseArray.length === updatedFields[updatedField].length &&
596
+ getApiKeyResponseArray.every((value, index) => value === updatedFields[updatedField][index]));
597
+ }
598
+ else {
599
+ return getApiKeyResponse[updatedField] === updatedFields[updatedField];
600
+ }
591
601
  });
592
602
  };
593
603
  const wait = (_, waitRequestOptions) => createRetryablePromise(retry => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/client-search",
3
- "version": "4.17.0",
3
+ "version": "4.17.2",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,8 +16,8 @@
16
16
  "dist"
17
17
  ],
18
18
  "dependencies": {
19
- "@algolia/client-common": "4.17.0",
20
- "@algolia/requester-common": "4.17.0",
21
- "@algolia/transporter": "4.17.0"
19
+ "@algolia/client-common": "4.17.2",
20
+ "@algolia/requester-common": "4.17.2",
21
+ "@algolia/transporter": "4.17.2"
22
22
  }
23
23
  }