@algolia/client-search 5.10.2 → 5.12.0
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/README.md +4 -4
- package/dist/browser.d.ts +15 -8
- package/dist/builds/browser.js +12 -7
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +1 -1
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +1 -1
- package/dist/builds/fetch.js +12 -7
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +12 -7
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +12 -7
- package/dist/builds/node.js.map +1 -1
- package/dist/fetch.d.ts +15 -8
- package/dist/node.d.cts +15 -8
- package/dist/node.d.ts +15 -8
- package/dist/src/searchClient.cjs +12 -7
- package/dist/src/searchClient.cjs.map +1 -1
- package/dist/src/searchClient.js +12 -7
- package/dist/src/searchClient.js.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -41,11 +41,11 @@ All of our clients comes with type definition, and are available for both browse
|
|
|
41
41
|
### With a package manager
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
yarn add @algolia/client-search@5.
|
|
44
|
+
yarn add @algolia/client-search@5.12.0
|
|
45
45
|
# or
|
|
46
|
-
npm install @algolia/client-search@5.
|
|
46
|
+
npm install @algolia/client-search@5.12.0
|
|
47
47
|
# or
|
|
48
|
-
pnpm add @algolia/client-search@5.
|
|
48
|
+
pnpm add @algolia/client-search@5.12.0
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
### Without a package manager
|
|
@@ -53,7 +53,7 @@ pnpm add @algolia/client-search@5.10.2
|
|
|
53
53
|
Add the following JavaScript snippet to the <head> of your website:
|
|
54
54
|
|
|
55
55
|
```html
|
|
56
|
-
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-search@5.
|
|
56
|
+
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-search@5.12.0/dist/builds/browser.umd.js"></script>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
### Usage
|
package/dist/browser.d.ts
CHANGED
|
@@ -755,6 +755,10 @@ type GetObjectsParams = {
|
|
|
755
755
|
};
|
|
756
756
|
|
|
757
757
|
type GetObjectsResponse<T = Record<string, unknown>> = {
|
|
758
|
+
/**
|
|
759
|
+
* An optional status message.
|
|
760
|
+
*/
|
|
761
|
+
message?: string;
|
|
758
762
|
/**
|
|
759
763
|
* Retrieved records.
|
|
760
764
|
*/
|
|
@@ -1791,7 +1795,7 @@ type SearchRulesResponse = {
|
|
|
1791
1795
|
/**
|
|
1792
1796
|
* Synonym type.
|
|
1793
1797
|
*/
|
|
1794
|
-
type SynonymType = 'synonym' | 'onewaysynonym' | 'altcorrection1' | 'altcorrection2' | 'placeholder';
|
|
1798
|
+
type SynonymType = 'synonym' | 'onewaysynonym' | 'altcorrection1' | 'altcorrection2' | 'placeholder' | 'oneWaySynonym' | 'altCorrection1' | 'altCorrection2';
|
|
1795
1799
|
|
|
1796
1800
|
/**
|
|
1797
1801
|
* Synonym object.
|
|
@@ -2999,19 +3003,19 @@ type SearchClientNodeHelpers = {
|
|
|
2999
3003
|
generateSecuredApiKey: (opts: GenerateSecuredApiKeyOptions) => string;
|
|
3000
3004
|
getSecuredApiKeyRemainingValidity: (opts: GetSecuredApiKeyRemainingValidityOptions) => number;
|
|
3001
3005
|
};
|
|
3002
|
-
type DeleteObjectsOptions = Pick<ChunkedBatchOptions, 'indexName'> & {
|
|
3006
|
+
type DeleteObjectsOptions = Pick<ChunkedBatchOptions, 'indexName' | 'waitForTasks'> & {
|
|
3003
3007
|
/**
|
|
3004
3008
|
* The objectIDs to delete.
|
|
3005
3009
|
*/
|
|
3006
3010
|
objectIDs: string[];
|
|
3007
3011
|
};
|
|
3008
|
-
type PartialUpdateObjectsOptions = Pick<ChunkedBatchOptions, 'indexName' | 'objects'> & {
|
|
3012
|
+
type PartialUpdateObjectsOptions = Pick<ChunkedBatchOptions, 'indexName' | 'objects' | 'waitForTasks'> & {
|
|
3009
3013
|
/**
|
|
3010
3014
|
*To be provided if non-existing objects are passed, otherwise, the call will fail.
|
|
3011
3015
|
*/
|
|
3012
3016
|
createIfNotExists?: boolean;
|
|
3013
3017
|
};
|
|
3014
|
-
type SaveObjectsOptions = Pick<ChunkedBatchOptions, 'indexName' | 'objects'>;
|
|
3018
|
+
type SaveObjectsOptions = Pick<ChunkedBatchOptions, 'indexName' | 'objects' | 'waitForTasks'>;
|
|
3015
3019
|
type ChunkedBatchOptions = ReplaceAllObjectsOptions & {
|
|
3016
3020
|
/**
|
|
3017
3021
|
* The `batch` `action` to perform on the given array of `objects`, defaults to `addObject`.
|
|
@@ -3037,7 +3041,7 @@ type ReplaceAllObjectsOptions = {
|
|
|
3037
3041
|
batchSize?: number;
|
|
3038
3042
|
};
|
|
3039
3043
|
|
|
3040
|
-
declare const apiClientVersion = "5.
|
|
3044
|
+
declare const apiClientVersion = "5.12.0";
|
|
3041
3045
|
declare function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {
|
|
3042
3046
|
transporter: _algolia_client_common.Transporter;
|
|
3043
3047
|
/**
|
|
@@ -3160,9 +3164,10 @@ declare function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption,
|
|
|
3160
3164
|
* @param saveObjects - The `saveObjects` object.
|
|
3161
3165
|
* @param saveObjects.indexName - The `indexName` to save `objects` in.
|
|
3162
3166
|
* @param saveObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
3167
|
+
* @param saveObjects.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
|
|
3163
3168
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
|
|
3164
3169
|
*/
|
|
3165
|
-
saveObjects({ indexName, objects }: SaveObjectsOptions, requestOptions?: RequestOptions): Promise<BatchResponse[]>;
|
|
3170
|
+
saveObjects({ indexName, objects, waitForTasks }: SaveObjectsOptions, requestOptions?: RequestOptions): Promise<BatchResponse[]>;
|
|
3166
3171
|
/**
|
|
3167
3172
|
* Helper: Deletes every records for the given objectIDs. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objectIDs in it.
|
|
3168
3173
|
*
|
|
@@ -3170,9 +3175,10 @@ declare function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption,
|
|
|
3170
3175
|
* @param deleteObjects - The `deleteObjects` object.
|
|
3171
3176
|
* @param deleteObjects.indexName - The `indexName` to delete `objectIDs` from.
|
|
3172
3177
|
* @param deleteObjects.objectIDs - The objectIDs to delete.
|
|
3178
|
+
* @param deleteObjects.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
|
|
3173
3179
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
|
|
3174
3180
|
*/
|
|
3175
|
-
deleteObjects({ indexName, objectIDs }: DeleteObjectsOptions, requestOptions?: RequestOptions): Promise<BatchResponse[]>;
|
|
3181
|
+
deleteObjects({ indexName, objectIDs, waitForTasks }: DeleteObjectsOptions, requestOptions?: RequestOptions): Promise<BatchResponse[]>;
|
|
3176
3182
|
/**
|
|
3177
3183
|
* Helper: Replaces object content of all the given objects according to their respective `objectID` field. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it.
|
|
3178
3184
|
*
|
|
@@ -3181,9 +3187,10 @@ declare function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption,
|
|
|
3181
3187
|
* @param partialUpdateObjects.indexName - The `indexName` to update `objects` in.
|
|
3182
3188
|
* @param partialUpdateObjects.objects - The array of `objects` to update in the given Algolia `indexName`.
|
|
3183
3189
|
* @param partialUpdateObjects.createIfNotExists - To be provided if non-existing objects are passed, otherwise, the call will fail..
|
|
3190
|
+
* @param partialUpdateObjects.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
|
|
3184
3191
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
|
|
3185
3192
|
*/
|
|
3186
|
-
partialUpdateObjects({ indexName, objects, createIfNotExists }: PartialUpdateObjectsOptions, requestOptions?: RequestOptions): Promise<BatchResponse[]>;
|
|
3193
|
+
partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks }: PartialUpdateObjectsOptions, requestOptions?: RequestOptions): Promise<BatchResponse[]>;
|
|
3187
3194
|
/**
|
|
3188
3195
|
* Helper: Replaces all objects (records) in the given `index_name` with the given `objects`. A temporary index is created during this process in order to backup your data.
|
|
3189
3196
|
* See https://api-clients-automation.netlify.app/docs/add-new-api-client#5-helpers for implementation details.
|
package/dist/builds/browser.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
getAlgoliaAgent,
|
|
20
20
|
shuffle
|
|
21
21
|
} from "@algolia/client-common";
|
|
22
|
-
var apiClientVersion = "5.
|
|
22
|
+
var apiClientVersion = "5.12.0";
|
|
23
23
|
function getDefaultHosts(appId) {
|
|
24
24
|
return [
|
|
25
25
|
{
|
|
@@ -375,10 +375,11 @@ function createSearchClient({
|
|
|
375
375
|
* @param saveObjects - The `saveObjects` object.
|
|
376
376
|
* @param saveObjects.indexName - The `indexName` to save `objects` in.
|
|
377
377
|
* @param saveObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
378
|
+
* @param saveObjects.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
|
|
378
379
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
|
|
379
380
|
*/
|
|
380
|
-
async saveObjects({ indexName, objects }, requestOptions) {
|
|
381
|
-
return await this.chunkedBatch({ indexName, objects, action: "addObject" }, requestOptions);
|
|
381
|
+
async saveObjects({ indexName, objects, waitForTasks }, requestOptions) {
|
|
382
|
+
return await this.chunkedBatch({ indexName, objects, action: "addObject", waitForTasks }, requestOptions);
|
|
382
383
|
},
|
|
383
384
|
/**
|
|
384
385
|
* Helper: Deletes every records for the given objectIDs. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objectIDs in it.
|
|
@@ -387,14 +388,16 @@ function createSearchClient({
|
|
|
387
388
|
* @param deleteObjects - The `deleteObjects` object.
|
|
388
389
|
* @param deleteObjects.indexName - The `indexName` to delete `objectIDs` from.
|
|
389
390
|
* @param deleteObjects.objectIDs - The objectIDs to delete.
|
|
391
|
+
* @param deleteObjects.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
|
|
390
392
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
|
|
391
393
|
*/
|
|
392
|
-
async deleteObjects({ indexName, objectIDs }, requestOptions) {
|
|
394
|
+
async deleteObjects({ indexName, objectIDs, waitForTasks }, requestOptions) {
|
|
393
395
|
return await this.chunkedBatch(
|
|
394
396
|
{
|
|
395
397
|
indexName,
|
|
396
398
|
objects: objectIDs.map((objectID) => ({ objectID })),
|
|
397
|
-
action: "deleteObject"
|
|
399
|
+
action: "deleteObject",
|
|
400
|
+
waitForTasks
|
|
398
401
|
},
|
|
399
402
|
requestOptions
|
|
400
403
|
);
|
|
@@ -407,14 +410,16 @@ function createSearchClient({
|
|
|
407
410
|
* @param partialUpdateObjects.indexName - The `indexName` to update `objects` in.
|
|
408
411
|
* @param partialUpdateObjects.objects - The array of `objects` to update in the given Algolia `indexName`.
|
|
409
412
|
* @param partialUpdateObjects.createIfNotExists - To be provided if non-existing objects are passed, otherwise, the call will fail..
|
|
413
|
+
* @param partialUpdateObjects.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
|
|
410
414
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
|
|
411
415
|
*/
|
|
412
|
-
async partialUpdateObjects({ indexName, objects, createIfNotExists }, requestOptions) {
|
|
416
|
+
async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks }, requestOptions) {
|
|
413
417
|
return await this.chunkedBatch(
|
|
414
418
|
{
|
|
415
419
|
indexName,
|
|
416
420
|
objects,
|
|
417
|
-
action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate"
|
|
421
|
+
action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate",
|
|
422
|
+
waitForTasks
|
|
418
423
|
},
|
|
419
424
|
requestOptions
|
|
420
425
|
);
|