Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit be11fdd

Browse files
authored
Merge pull request #52 from rubenpenyafiel/fix/retry-map
RetryMap was never used.
2 parents 6f90bb4 + 1c0355c commit be11fdd

19 files changed

+582
-227
lines changed

dist/apisearch.js

Lines changed: 102 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Apisearch.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { HttpClient } from "./Http/HttpClient";
2+
import { RetryConfig } from "./Http/Retry";
23
import { Coordinate } from "./Model/Coordinate";
34
import { ItemUUID } from "./Model/ItemUUID";
45
import { Query } from "./Query/Query";
@@ -25,6 +26,7 @@ export default class Apisearch {
2526
api_version?: string;
2627
timeout?: number;
2728
override_queries?: boolean;
29+
retry_map_config?: RetryConfig[];
2830
http_client?: HttpClient;
2931
};
3032
}): HttpRepository;

lib/Apisearch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ var Apisearch = /** @class */ (function () {
2626
*/
2727
Apisearch.createRepository = function (config) {
2828
Apisearch.ensureRepositoryConfigIsValid(config);
29-
config.options = tslib_1.__assign({ api_version: "v1", override_queries: true, timeout: 5000 }, config.options);
29+
config.options = tslib_1.__assign({ api_version: "v1", override_queries: true, retry_map_config: [], timeout: 5000 }, config.options);
3030
/**
3131
* Client
3232
*/
3333
var httpClient = typeof config.options.http_client !== "undefined"
3434
? config.options.http_client
35-
: new AxiosClient_1.AxiosClient(config.options.endpoint, config.options.api_version, config.options.timeout, new RetryMap_1.RetryMap(), config.options.override_queries);
35+
: new AxiosClient_1.AxiosClient(config.options.endpoint, config.options.api_version, config.options.timeout, RetryMap_1.RetryMap.createFromArray(config.options.retry_map_config), config.options.override_queries);
3636
return new HttpRepository_1.HttpRepository(httpClient, config.app_id, config.index_id, config.token, new Transformer_1.Transformer());
3737
};
3838
/**

lib/Http/AxiosClient.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,13 @@ export declare class AxiosClient extends Client implements HttpClient {
4545
* @param url
4646
*/
4747
generateCancelToken(url: string): void;
48+
/**
49+
* Performs the request and maybe retries in case of failure
50+
*
51+
* @param sendRequest The function that, when called, will perform the HTTP request
52+
* @param retry If it's an instance of Retry and the request fails it will retry the request
53+
*
54+
* @return {Promise<AxiosResponse>}
55+
*/
56+
private tryRequest;
4857
}

0 commit comments

Comments
 (0)