Skip to content

Commit 82bcda5

Browse files
fix(specs): allow null records in getObjects response (generated)
algolia/api-clients-automation#6582 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
1 parent 1fee525 commit 82bcda5

7 files changed

Lines changed: 48 additions & 11 deletions

File tree

packages/algoliasearch/builds/browser.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
22

33
import type { ClientOptions, RequestOptions } from '@algolia/client-common';
4+
import { DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES } from '@algolia/client-common';
45

56
import type { AbtestingV3Client } from '@algolia/abtesting';
67
import { abtestingV3Client } from '@algolia/abtesting';
@@ -102,7 +103,7 @@ export type Algoliasearch = SearchClient & {
102103
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
103104
* @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `objects.length / batchSize`. Defaults to 1000.
104105
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
105-
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
106+
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 800 by default.
106107
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `push`, `operationIndex` and `getEvent` method and merged with the transporter requestOptions.
107108
*/
108109
replaceAllObjectsWithTransformation: (
@@ -203,7 +204,13 @@ export function algoliasearch(
203204
},
204205

205206
async replaceAllObjectsWithTransformation(
206-
{ indexName, objects, batchSize, scopes, maxRetries = 100 }: ReplaceAllObjectsOptions,
207+
{
208+
indexName,
209+
objects,
210+
batchSize,
211+
scopes,
212+
maxRetries = DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES,
213+
}: ReplaceAllObjectsOptions,
207214
requestOptions?: RequestOptions | undefined,
208215
): Promise<ReplaceAllObjectsWithTransformationResponse> {
209216
if (!ingestionTransporter) {

packages/algoliasearch/builds/fetch.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
22

33
import type { ClientOptions, RequestOptions } from '@algolia/client-common';
4+
import { DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES } from '@algolia/client-common';
45

56
import type { AbtestingV3Client } from '@algolia/abtesting';
67
import { abtestingV3Client } from '@algolia/abtesting';
@@ -102,7 +103,7 @@ export type Algoliasearch = SearchClient & {
102103
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
103104
* @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `objects.length / batchSize`. Defaults to 1000.
104105
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
105-
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
106+
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 800 by default.
106107
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `push`, `operationIndex` and `getEvent` method and merged with the transporter requestOptions.
107108
*/
108109
replaceAllObjectsWithTransformation: (
@@ -203,7 +204,13 @@ export function algoliasearch(
203204
},
204205

205206
async replaceAllObjectsWithTransformation(
206-
{ indexName, objects, batchSize, scopes, maxRetries = 100 }: ReplaceAllObjectsOptions,
207+
{
208+
indexName,
209+
objects,
210+
batchSize,
211+
scopes,
212+
maxRetries = DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES,
213+
}: ReplaceAllObjectsOptions,
207214
requestOptions?: RequestOptions | undefined,
208215
): Promise<ReplaceAllObjectsWithTransformationResponse> {
209216
if (!ingestionTransporter) {

packages/algoliasearch/builds/node.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
22

33
import type { ClientOptions, RequestOptions } from '@algolia/client-common';
4+
import { DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES } from '@algolia/client-common';
45

56
import type { AbtestingV3Client } from '@algolia/abtesting';
67
import { abtestingV3Client } from '@algolia/abtesting';
@@ -102,7 +103,7 @@ export type Algoliasearch = SearchClient & {
102103
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
103104
* @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `objects.length / batchSize`. Defaults to 1000.
104105
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
105-
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
106+
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 800 by default.
106107
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `push`, `operationIndex` and `getEvent` method and merged with the transporter requestOptions.
107108
*/
108109
replaceAllObjectsWithTransformation: (
@@ -203,7 +204,13 @@ export function algoliasearch(
203204
},
204205

205206
async replaceAllObjectsWithTransformation(
206-
{ indexName, objects, batchSize, scopes, maxRetries = 100 }: ReplaceAllObjectsOptions,
207+
{
208+
indexName,
209+
objects,
210+
batchSize,
211+
scopes,
212+
maxRetries = DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES,
213+
}: ReplaceAllObjectsOptions,
207214
requestOptions?: RequestOptions | undefined,
208215
): Promise<ReplaceAllObjectsWithTransformationResponse> {
209216
if (!ingestionTransporter) {

packages/algoliasearch/builds/worker.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
22

33
import type { ClientOptions, RequestOptions } from '@algolia/client-common';
4+
import { DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES } from '@algolia/client-common';
45

56
import type { AbtestingV3Client } from '@algolia/abtesting';
67
import { abtestingV3Client } from '@algolia/abtesting';
@@ -102,7 +103,7 @@ export type Algoliasearch = SearchClient & {
102103
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
103104
* @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `objects.length / batchSize`. Defaults to 1000.
104105
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
105-
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
106+
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 800 by default.
106107
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `push`, `operationIndex` and `getEvent` method and merged with the transporter requestOptions.
107108
*/
108109
replaceAllObjectsWithTransformation: (
@@ -203,7 +204,13 @@ export function algoliasearch(
203204
},
204205

205206
async replaceAllObjectsWithTransformation(
206-
{ indexName, objects, batchSize, scopes, maxRetries = 100 }: ReplaceAllObjectsOptions,
207+
{
208+
indexName,
209+
objects,
210+
batchSize,
211+
scopes,
212+
maxRetries = DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES,
213+
}: ReplaceAllObjectsOptions,
207214
requestOptions?: RequestOptions | undefined,
208215
): Promise<ReplaceAllObjectsWithTransformationResponse> {
209216
if (!ingestionTransporter) {

packages/client-common/src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ export const DEFAULT_WRITE_TIMEOUT_BROWSER = 30000;
55
export const DEFAULT_CONNECT_TIMEOUT_NODE = 2000;
66
export const DEFAULT_READ_TIMEOUT_NODE = 5000;
77
export const DEFAULT_WRITE_TIMEOUT_NODE = 30000;
8+
9+
export const DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES = 800;

packages/client-search/model/getObjectsResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export type GetObjectsResponse<T = Record<string, unknown>> = {
99
/**
1010
* Retrieved records.
1111
*/
12-
results: T[];
12+
results: (T | null)[];
1313
};

packages/client-search/src/searchClient.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {
1111
} from '@algolia/client-common';
1212
import {
1313
ApiError,
14+
DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES,
1415
createAuth,
1516
createIterablePromise,
1617
createTransporter,
@@ -638,11 +639,17 @@ export function createSearchClient({
638639
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
639640
* @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `objects.length / batchSize`. Defaults to 1000.
640641
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
641-
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
642+
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 800 by default.
642643
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch`, `operationIndex` and `getTask` method and merged with the transporter requestOptions.
643644
*/
644645
async replaceAllObjects(
645-
{ indexName, objects, batchSize, scopes, maxRetries = 100 }: ReplaceAllObjectsOptions,
646+
{
647+
indexName,
648+
objects,
649+
batchSize,
650+
scopes,
651+
maxRetries = DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES,
652+
}: ReplaceAllObjectsOptions,
646653
requestOptions?: RequestOptions | undefined,
647654
): Promise<ReplaceAllObjectsResponse> {
648655
const randomSuffix = Math.floor(Math.random() * 1000000) + 100000;

0 commit comments

Comments
 (0)