Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

@algolia/client-common

Package Overview
Dependencies
Maintainers
3
Versions
304
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/client-common - npm Package Compare versions

Comparing version
5.1.1
to
5.2.1
+7
-4
dist/client-common.cjs

@@ -434,3 +434,3 @@ 'use strict';

return new ApiError(parsed.message, status, stackFrame);
} catch (e) {
} catch {
// ..

@@ -563,3 +563,6 @@ }

}
let responseTimeout = isRead ? requestOptions.timeouts?.read || timeouts.read : requestOptions.timeouts?.write || timeouts.write;
const timeout = {
...timeouts,
...requestOptions.timeouts
};
const payload = {

@@ -570,4 +573,4 @@ data,

url: serializeUrl(host, request.path, queryParameters),
connectTimeout: getTimeout(timeoutsCount, requestOptions.timeouts?.connect || timeouts.connect),
responseTimeout: getTimeout(timeoutsCount, responseTimeout)
connectTimeout: getTimeout(timeoutsCount, timeout.connect),
responseTimeout: getTimeout(timeoutsCount, isRead ? timeout.read : timeout.write)
};

@@ -574,0 +577,0 @@ /**

@@ -432,3 +432,3 @@ function createAuth(appId, apiKey, authMode = 'WithinHeaders') {

return new ApiError(parsed.message, status, stackFrame);
} catch (e) {
} catch {
// ..

@@ -561,3 +561,6 @@ }

}
let responseTimeout = isRead ? requestOptions.timeouts?.read || timeouts.read : requestOptions.timeouts?.write || timeouts.write;
const timeout = {
...timeouts,
...requestOptions.timeouts
};
const payload = {

@@ -568,4 +571,4 @@ data,

url: serializeUrl(host, request.path, queryParameters),
connectTimeout: getTimeout(timeoutsCount, requestOptions.timeouts?.connect || timeouts.connect),
responseTimeout: getTimeout(timeoutsCount, responseTimeout)
connectTimeout: getTimeout(timeoutsCount, timeout.connect),
responseTimeout: getTimeout(timeoutsCount, isRead ? timeout.read : timeout.write)
};

@@ -572,0 +575,0 @@ /**

@@ -1,1 +0,1 @@

{"version":3,"file":"createBrowserLocalStorageCache.d.ts","sourceRoot":"","sources":["../../../src/cache/createBrowserLocalStorageCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,0BAA0B,EAC1B,KAAK,EAEN,MAAM,UAAU,CAAC;AAElB,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,0BAA0B,GAClC,KAAK,CAiHP"}
{"version":3,"file":"createBrowserLocalStorageCache.d.ts","sourceRoot":"","sources":["../../../src/cache/createBrowserLocalStorageCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgC,0BAA0B,EAAE,KAAK,EAAe,MAAM,UAAU,CAAC;AAE7G,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,0BAA0B,GAAG,KAAK,CAuGzF"}

@@ -1,1 +0,1 @@

{"version":3,"file":"createFallbackableCache.d.ts","sourceRoot":"","sources":["../../../src/cache/createFallbackableCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAe,MAAM,UAAU,CAAC;AAI7E,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,wBAAwB,GAChC,KAAK,CA8CP"}
{"version":3,"file":"createFallbackableCache.d.ts","sourceRoot":"","sources":["../../../src/cache/createFallbackableCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAe,MAAM,UAAU,CAAC;AAI7E,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,GAAG,KAAK,CAuChF"}

@@ -1,1 +0,1 @@

{"version":3,"file":"createMemoryCache.d.ts","sourceRoot":"","sources":["../../../src/cache/createMemoryCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAe,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEvE,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,kBAA2C,GACnD,KAAK,CAmDP"}
{"version":3,"file":"createMemoryCache.d.ts","sourceRoot":"","sources":["../../../src/cache/createMemoryCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAe,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEvE,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAA2C,GAAG,KAAK,CAwC7F"}

@@ -1,1 +0,1 @@

{"version":3,"file":"createNullCache.d.ts","sourceRoot":"","sources":["../../../src/cache/createNullCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,UAAU,CAAC;AAEnD,wBAAgB,eAAe,IAAI,KAAK,CA+BvC"}
{"version":3,"file":"createNullCache.d.ts","sourceRoot":"","sources":["../../../src/cache/createNullCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,UAAU,CAAC;AAEnD,wBAAgB,eAAe,IAAI,KAAK,CA0BvC"}

@@ -1,1 +0,1 @@

{"version":3,"file":"createAlgoliaAgent.d.ts","sourceRoot":"","sources":["../../src/createAlgoliaAgent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAiBhE"}
{"version":3,"file":"createAlgoliaAgent.d.ts","sourceRoot":"","sources":["../../src/createAlgoliaAgent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAehE"}

@@ -6,3 +6,3 @@ import type { Requester } from './types';

};
export declare function createEchoRequester({ getURL, status, }: EchoRequesterParams): Requester;
export declare function createEchoRequester({ getURL, status }: EchoRequesterParams): Requester;
//# sourceMappingURL=createEchoRequester.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"createEchoRequester.d.ts","sourceRoot":"","sources":["../../src/createEchoRequester.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,SAAS,EAAY,MAAM,SAAS,CAAC;AAE7E,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AA0CF,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,MAAY,GACb,EAAE,mBAAmB,GAAG,SAAS,CAuBjC"}
{"version":3,"file":"createEchoRequester.d.ts","sourceRoot":"","sources":["../../src/createEchoRequester.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,SAAS,EAAY,MAAM,SAAS,CAAC;AAE7E,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAyCF,wBAAgB,mBAAmB,CAAC,EAAE,MAAM,EAAE,MAAY,EAAE,EAAE,mBAAmB,GAAG,SAAS,CAqB5F"}

@@ -7,3 +7,3 @@ import type { AlgoliaAgentOptions, AlgoliaAgent } from './types';

};
export declare function getAlgoliaAgent({ algoliaAgents, client, version, }: GetAlgoliaAgent): AlgoliaAgent;
export declare function getAlgoliaAgent({ algoliaAgents, client, version }: GetAlgoliaAgent): AlgoliaAgent;
//# sourceMappingURL=getAlgoliaAgent.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"getAlgoliaAgent.d.ts","sourceRoot":"","sources":["../../src/getAlgoliaAgent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjE,MAAM,MAAM,eAAe,GAAG;IAC5B,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC9B,aAAa,EACb,MAAM,EACN,OAAO,GACR,EAAE,eAAe,GAAG,YAAY,CAWhC"}
{"version":3,"file":"getAlgoliaAgent.d.ts","sourceRoot":"","sources":["../../src/getAlgoliaAgent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjE,MAAM,MAAM,eAAe,GAAG;IAC5B,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,eAAe,GAAG,YAAY,CASjG"}

@@ -1,1 +0,1 @@

{"version":3,"file":"createStatefulHost.d.ts","sourceRoot":"","sources":["../../../src/transporter/createStatefulHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAMnD,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,MAAM,GAAE,YAAY,CAAC,QAAQ,CAAQ,GACpC,YAAY,CAcd"}
{"version":3,"file":"createStatefulHost.d.ts","sourceRoot":"","sources":["../../../src/transporter/createStatefulHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAMnD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAE,YAAY,CAAC,QAAQ,CAAQ,GAAG,YAAY,CAYlG"}

@@ -1,1 +0,1 @@

{"version":3,"file":"createTransporter.d.ts","sourceRoot":"","sources":["../../../src/transporter/createTransporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAOV,kBAAkB,EAClB,WAAW,EAEZ,MAAM,UAAU,CAAC;AAsBlB,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,GACf,EAAE,kBAAkB,GAAG,WAAW,CAgTlC"}
{"version":3,"file":"createTransporter.d.ts","sourceRoot":"","sources":["../../../src/transporter/createTransporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAOV,kBAAkB,EAClB,WAAW,EAEZ,MAAM,UAAU,CAAC;AAalB,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,GACf,EAAE,kBAAkB,GAAG,WAAW,CAyRlC"}

@@ -1,1 +0,1 @@

{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/transporter/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAErD,qBAAa,YAAa,SAAQ,KAAK;IACrC,IAAI,EAAE,MAAM,CAAkB;gBAElB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAO1C;AAED,qBAAa,mBAAoB,SAAQ,YAAY;IACnD,UAAU,EAAE,UAAU,EAAE,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM;CAKpE;AAED,qBAAa,UAAW,SAAQ,mBAAmB;gBACrC,UAAU,EAAE,UAAU,EAAE;CAOrC;AAED,qBAAa,QAAS,SAAQ,mBAAmB;IAC/C,MAAM,EAAE,MAAM,CAAC;gBAGb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EAAE,EACxB,IAAI,SAAa;CAKpB;AAED,qBAAa,oBAAqB,SAAQ,YAAY;IACpD,QAAQ,EAAE,QAAQ,CAAC;gBAEP,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;CAIhD;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,MAAM,CAAC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c,EAAE,OAAO,EACvB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CAeT;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAMvE;AAED,wBAAgB,kBAAkB,CAChC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,QAAQ,EAC7B,UAAU,EAAE,UAAU,EAAE,GACvB,KAAK,CAgBP"}
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/transporter/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI9G,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAYtD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,GAAG,MAAM,CAW/F;AAED,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,eAAe,GAAG,MAAM,CAa5E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAQlG;AAED,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,OAAO,EACpB,cAAc,EAAE,OAAO,EACvB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CAeT;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAMvE;AAED,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,KAAK,CAWjG"}
import type { Response } from '../types';
export declare function isNetworkError({ isTimedOut, status, }: Omit<Response, 'content'>): boolean;
export declare function isRetryable({ isTimedOut, status, }: Omit<Response, 'content'>): boolean;
export declare function isNetworkError({ isTimedOut, status }: Omit<Response, 'content'>): boolean;
export declare function isRetryable({ isTimedOut, status }: Omit<Response, 'content'>): boolean;
export declare function isSuccess({ status }: Pick<Response, 'status'>): boolean;
//# sourceMappingURL=responses.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../src/transporter/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,MAAM,GACP,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,OAAO,CAErC;AAED,wBAAgB,WAAW,CAAC,EAC1B,UAAU,EACV,MAAM,GACP,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,OAAO,CAMrC;AAED,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,OAAO,CAEvE"}
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../src/transporter/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,wBAAgB,cAAc,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,OAAO,CAEzF;AAED,wBAAgB,WAAW,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,OAAO,CAEtF;AAED,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,OAAO,CAEvE"}

@@ -1,1 +0,1 @@

{"version":3,"file":"stackTrace.d.ts","sourceRoot":"","sources":["../../../src/transporter/stackTrace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,UAAU,EAAE,MAAM,UAAU,CAAC;AAEpD,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,UAAU,EAAE,GACvB,UAAU,EAAE,CAId;AAED,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,UAAU,GACrB,UAAU,CAiBZ"}
{"version":3,"file":"stackTrace.d.ts","sourceRoot":"","sources":["../../../src/transporter/stackTrace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,UAAU,EAAE,MAAM,UAAU,CAAC;AAEpD,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAEnF;AAED,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAe/E"}

@@ -1,1 +0,1 @@

{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/types/cache.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAClB;;OAEG;IACH,GAAG,EAAE,CAAC,MAAM,EACV,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,EACjC,YAAY,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACnC,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,KACzB,OAAO,CAAC,MAAM,CAAC,CAAC;IAErB;;OAEG;IACH,GAAG,EAAE,CAAC,MAAM,EACV,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,EACjC,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,MAAM,CAAC,CAAC;IAErB;;OAEG;IACH,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D;;OAEG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B,C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ChE,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,aAAa,EAAE,mBAAmB,EAAE,CAAC;CACtC,CAAC;AAEJ,MAAM,MAAM,aAAa,GAAG,OAAO,CACjC,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,OAAO,CAAC,CAC9C,CAAC"}
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../../src/types/createClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE7E,MAAM,MAAM,QAAQ,GAAG,eAAe,GAAG,uBAAuB,CAAC;AAEjE,KAAK,4BAA4B,GAAG,aAAa,GAAG,qBAAqB,GAAG,OAAO,CAAC;AAEpF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,kBAAkB,EAAE,4BAA4B,GAAG,cAAc,CAAC,GACvG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,4BAA4B,CAAC,CAAC,GAAG;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,aAAa,EAAE,mBAAmB,EAAE,CAAC;CACtC,CAAC;AAEJ,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC"}

@@ -1,1 +0,1 @@

{"version":3,"file":"transporter.d.ts","sourceRoot":"","sources":["../../../src/types/transporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5E,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;CAC5B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG;IAC7C;;;OAGG;IACH,OAAO,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;CACvG,CAAC"}
{
"name": "@algolia/client-common",
"version": "5.1.1",
"version": "5.2.1",
"description": "Common package for the Algolia JavaScript API client.",

@@ -26,9 +26,9 @@ "repository": {

"devDependencies": {
"@babel/preset-env": "7.25.3",
"@babel/preset-env": "7.25.4",
"@babel/preset-typescript": "7.24.7",
"@types/jest": "29.5.12",
"@types/node": "20.14.14",
"@types/node": "22.5.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"ts-jest": "29.2.4",
"ts-jest": "29.2.5",
"typescript": "5.5.4"

@@ -35,0 +35,0 @@ },

@@ -29,5 +29,3 @@ import { createBrowserLocalStorageCache } from '../../cache';

expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject(
{ bar: 1 }
);
expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject({ bar: 1 });
expect(missMock.mock.calls.length).toBe(1);

@@ -37,5 +35,3 @@

expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject(
{ foo: 2 }
);
expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject({ foo: 2 });
expect(missMock.mock.calls.length).toBe(1);

@@ -56,3 +52,3 @@ });

miss: () => Promise.resolve(missMock()),
})
}),
).toMatchObject({ bar: 1 });

@@ -71,5 +67,3 @@

expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject(
{ bar: 2 }
);
expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject({ bar: 2 });
expect(missMock.mock.calls.length).toBe(1);

@@ -90,3 +84,3 @@ });

miss: () => Promise.resolve(missMock()),
})
}),
).toMatchObject({ bar: 2 });

@@ -110,3 +104,3 @@

miss: () => Promise.resolve(missMock()),
})
}),
).toMatchObject({ bar: 2 });

@@ -120,4 +114,3 @@

it('do throws localstorage exceptions on access', async () => {
const message =
"Failed to read the 'localStorage' property from 'Window': Access is denied for this document.";
const message = "Failed to read the 'localStorage' property from 'Window': Access is denied for this document.";
const cache = createBrowserLocalStorageCache(

@@ -135,4 +128,4 @@ new Proxy(

},
}
)
},
),
);

@@ -144,8 +137,4 @@ const key = { foo: 'bar' };

await expect(cache.delete(key)).rejects.toEqual(new DOMException(message));
await expect(cache.set(key, value)).rejects.toEqual(
new DOMException(message)
);
await expect(
cache.get(key, () => Promise.resolve(fallback))
).rejects.toEqual(new DOMException(message));
await expect(cache.set(key, value)).rejects.toEqual(new DOMException(message));
await expect(cache.get(key, () => Promise.resolve(fallback))).rejects.toEqual(new DOMException(message));
});

@@ -165,5 +154,3 @@

await expect(cache.set(key, value)).rejects.toEqual(new Error(message));
await expect(
cache.get(key, () => Promise.resolve(fallback))
).rejects.toEqual(new Error(message));
await expect(cache.get(key, () => Promise.resolve(fallback))).rejects.toEqual(new Error(message));
});

@@ -188,10 +175,6 @@

const localStorageValue = localStorage.getItem(
`algolia-client-js-${version}`
);
const localStorageValue = localStorage.getItem(`algolia-client-js-${version}`);
expect(JSON.parse(localStorageValue ? localStorageValue : '{}')).toEqual(
expectedValue
);
expect(JSON.parse(localStorageValue ? localStorageValue : '{}')).toEqual(expectedValue);
});
});

@@ -19,7 +19,5 @@ import { createMemoryCache } from '../../cache';

expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject(
{
bar: 1,
}
);
expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject({
bar: 1,
});

@@ -29,5 +27,3 @@ await cache.set({ key: 'foo' }, { foo: 2 });

expect(missMock.mock.calls.length).toBe(1);
expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject(
{ foo: 2 }
);
expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject({ foo: 2 });
expect(missMock.mock.calls.length).toBe(1);

@@ -59,5 +55,3 @@ });

expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject(
{ bar: 2 }
);
expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject({ bar: 2 });
expect(missMock.mock.calls.length).toBe(1);

@@ -74,5 +68,3 @@ });

expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject(
{ bar: 2 }
);
expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject({ bar: 2 });
expect(missMock.mock.calls.length).toBe(1);

@@ -89,7 +81,5 @@ });

expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject(
{ bar: 2 }
);
expect(await cache.get({ key: 'foo' }, defaultValue, events)).toMatchObject({ bar: 2 });
expect(missMock.mock.calls.length).toBe(1);
});
});

@@ -21,7 +21,5 @@ import { createNullCache } from '../../cache';

expect(await cache.get({ key: 'key' }, defaultValue, events)).toMatchObject(
{
bar: 12,
}
);
expect(await cache.get({ key: 'key' }, defaultValue, events)).toMatchObject({
bar: 12,
});

@@ -34,7 +32,5 @@ expect(missMock.mock.calls.length).toBe(1);

expect(await cache.get({ foo: 'foo' }, defaultValue, events)).toMatchObject(
{
bar: 12,
}
);
expect(await cache.get({ foo: 'foo' }, defaultValue, events)).toMatchObject({
bar: 12,
});

@@ -41,0 +37,0 @@ expect(missMock.mock.calls.length).toBe(1);

@@ -159,5 +159,3 @@ import { createIterablePromise } from '../createIterablePromise';

await expect(promise).rejects.toEqual(
expect.objectContaining({ message: 'nope' })
);
await expect(promise).rejects.toEqual(expect.objectContaining({ message: 'nope' }));
});

@@ -182,5 +180,3 @@

await expect(promise).rejects.toEqual(
expect.objectContaining({ message: 'nope' })
);
await expect(promise).rejects.toEqual(expect.objectContaining({ message: 'nope' }));
});

@@ -209,3 +205,3 @@

message: 'Error is thrown: 3/3',
})
}),
);

@@ -236,3 +232,3 @@ expect(calls).toBe(MAX_RETRIES);

message: 'Error is thrown: 3/3',
})
}),
);

@@ -239,0 +235,0 @@ expect(calls).toBe(MAX_RETRIES);

@@ -1,11 +0,4 @@

import type {
BrowserLocalStorageCacheItem,
BrowserLocalStorageOptions,
Cache,
CacheEvents,
} from '../types';
import type { BrowserLocalStorageCacheItem, BrowserLocalStorageOptions, Cache, CacheEvents } from '../types';
export function createBrowserLocalStorageCache(
options: BrowserLocalStorageOptions
): Cache {
export function createBrowserLocalStorageCache(options: BrowserLocalStorageOptions): Cache {
let storage: Storage;

@@ -38,3 +31,3 @@ // We've changed the namespace to avoid conflicts with v4, as this version is a huge breaking change

return cacheItem.timestamp !== undefined;
})
}),
);

@@ -49,10 +42,8 @@

const filteredNamespaceWithoutExpiredItems = Object.fromEntries(
Object.entries(filteredNamespaceWithoutOldFormattedCacheItems).filter(
([, cacheItem]) => {
const currentTimestamp = new Date().getTime();
const isExpired = cacheItem.timestamp + timeToLive < currentTimestamp;
Object.entries(filteredNamespaceWithoutOldFormattedCacheItems).filter(([, cacheItem]) => {
const currentTimestamp = new Date().getTime();
const isExpired = cacheItem.timestamp + timeToLive < currentTimestamp;
return !isExpired;
}
)
return !isExpired;
}),
);

@@ -69,3 +60,3 @@

miss: () => Promise.resolve(),
}
},
): Promise<TValue> {

@@ -76,11 +67,6 @@ return Promise.resolve()

return getNamespace<Promise<BrowserLocalStorageCacheItem>>()[
JSON.stringify(key)
];
return getNamespace<Promise<BrowserLocalStorageCacheItem>>()[JSON.stringify(key)];
})
.then((value) => {
return Promise.all([
value ? value.value : defaultValue(),
value !== undefined,
]);
return Promise.all([value ? value.value : defaultValue(), value !== undefined]);
})

@@ -93,6 +79,3 @@ .then(([value, exists]) => {

set<TValue>(
key: Record<string, any> | string,
value: TValue
): Promise<TValue> {
set<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {
return Promise.resolve().then(() => {

@@ -99,0 +82,0 @@ const namespace = getNamespace();

@@ -5,5 +5,3 @@ import type { FallbackableCacheOptions, Cache, CacheEvents } from '../types';

export function createFallbackableCache(
options: FallbackableCacheOptions
): Cache {
export function createFallbackableCache(options: FallbackableCacheOptions): Cache {
const caches = [...options.caches];

@@ -22,17 +20,10 @@ const current = caches.shift();

miss: (): Promise<void> => Promise.resolve(),
}
},
): Promise<TValue> {
return current.get(key, defaultValue, events).catch(() => {
return createFallbackableCache({ caches }).get(
key,
defaultValue,
events
);
return createFallbackableCache({ caches }).get(key, defaultValue, events);
});
},
set<TValue>(
key: Record<string, any> | string,
value: TValue
): Promise<TValue> {
set<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {
return current.set(key, value).catch(() => {

@@ -39,0 +30,0 @@ return createFallbackableCache({ caches }).set(key, value);

import type { Cache, CacheEvents, MemoryCacheOptions } from '../types';
export function createMemoryCache(
options: MemoryCacheOptions = { serializable: true }
): Cache {
export function createMemoryCache(options: MemoryCacheOptions = { serializable: true }): Cache {
let cache: Record<string, any> = {};

@@ -14,3 +12,3 @@

miss: (): Promise<void> => Promise.resolve(),
}
},
): Promise<TValue> {

@@ -20,7 +18,3 @@ const keyAsString = JSON.stringify(key);

if (keyAsString in cache) {
return Promise.resolve(
options.serializable
? JSON.parse(cache[keyAsString])
: cache[keyAsString]
);
return Promise.resolve(options.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]);
}

@@ -30,14 +24,7 @@

return promise
.then((value: TValue) => events.miss(value))
.then(() => promise);
return promise.then((value: TValue) => events.miss(value)).then(() => promise);
},
set<TValue>(
key: Record<string, any> | string,
value: TValue
): Promise<TValue> {
cache[JSON.stringify(key)] = options.serializable
? JSON.stringify(value)
: value;
set<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {
cache[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;

@@ -44,0 +31,0 @@ return Promise.resolve(value);

@@ -10,15 +10,10 @@ import type { Cache, CacheEvents } from '../types';

miss: (): Promise<void> => Promise.resolve(),
}
},
): Promise<TValue> {
const value = defaultValue();
return value
.then((result) => Promise.all([result, events.miss(result)]))
.then(([result]) => result);
return value.then((result) => Promise.all([result, events.miss(result)])).then(([result]) => result);
},
set<TValue>(
_key: Record<string, any> | string,
value: TValue
): Promise<TValue> {
set<TValue>(_key: Record<string, any> | string, value: TValue): Promise<TValue> {
return Promise.resolve(value);

@@ -25,0 +20,0 @@ },

@@ -7,5 +7,3 @@ import type { AlgoliaAgentOptions, AlgoliaAgent } from './types';

add(options: AlgoliaAgentOptions): AlgoliaAgent {
const addedAlgoliaAgent = `; ${options.segment}${
options.version !== undefined ? ` (${options.version})` : ''
}`;
const addedAlgoliaAgent = `; ${options.segment}${options.version !== undefined ? ` (${options.version})` : ''}`;

@@ -12,0 +10,0 @@ if (algoliaAgent.value.indexOf(addedAlgoliaAgent) === -1) {

@@ -6,3 +6,3 @@ import type { AuthMode, Headers, QueryParameters } from './types';

apiKey: string,
authMode: AuthMode = 'WithinHeaders'
authMode: AuthMode = 'WithinHeaders',
): {

@@ -9,0 +9,0 @@ readonly headers: () => Headers;

@@ -42,4 +42,3 @@ import type { EchoResponse, EndRequest, Requester, Response } from './types';

algoliaAgent,
searchParams:
Object.keys(searchParams).length === 0 ? undefined : searchParams,
searchParams: Object.keys(searchParams).length === 0 ? undefined : searchParams,
path: pathname,

@@ -49,10 +48,5 @@ };

export function createEchoRequester({
getURL,
status = 200,
}: EchoRequesterParams): Requester {
export function createEchoRequester({ getURL, status = 200 }: EchoRequesterParams): Requester {
function send(request: EndRequest): Promise<Response> {
const { host, searchParams, algoliaAgent, path } = getUrlParams(
getURL(request.url)
);
const { host, searchParams, algoliaAgent, path } = getUrlParams(getURL(request.url));

@@ -59,0 +53,0 @@ const content: EchoResponse = {

@@ -10,7 +10,3 @@ import { createAlgoliaAgent } from './createAlgoliaAgent';

export function getAlgoliaAgent({
algoliaAgents,
client,
version,
}: GetAlgoliaAgent): AlgoliaAgent {
export function getAlgoliaAgent({ algoliaAgents, client, version }: GetAlgoliaAgent): AlgoliaAgent {
const defaultAlgoliaAgent = createAlgoliaAgent(version).add({

@@ -21,7 +17,5 @@ segment: client,

algoliaAgents.forEach((algoliaAgent) =>
defaultAlgoliaAgent.add(algoliaAgent)
);
algoliaAgents.forEach((algoliaAgent) => defaultAlgoliaAgent.add(algoliaAgent));
return defaultAlgoliaAgent;
}

@@ -7,6 +7,3 @@ import type { Host, StatefulHost } from '../types';

export function createStatefulHost(
host: Host,
status: StatefulHost['status'] = 'up'
): StatefulHost {
export function createStatefulHost(host: Host, status: StatefulHost['status'] = 'up'): StatefulHost {
const lastUpdate = Date.now();

@@ -19,5 +16,3 @@

function isTimedOut(): boolean {
return (
status === 'timed out' && Date.now() - lastUpdate <= EXPIRATION_DELAY
);
return status === 'timed out' && Date.now() - lastUpdate <= EXPIRATION_DELAY;
}

@@ -24,0 +19,0 @@

@@ -15,14 +15,5 @@ import type {

import { RetryError } from './errors';
import {
deserializeFailure,
deserializeSuccess,
serializeData,
serializeHeaders,
serializeUrl,
} from './helpers';
import { deserializeFailure, deserializeSuccess, serializeData, serializeHeaders, serializeUrl } from './helpers';
import { isRetryable, isSuccess } from './responses';
import {
stackTraceWithoutCredentials,
stackFrameWithoutCredentials,
} from './stackTrace';
import { stackTraceWithoutCredentials, stackFrameWithoutCredentials } from './stackTrace';

@@ -45,5 +36,3 @@ type RetryableOptions = {

}: TransporterOptions): Transporter {
async function createRetryableOptions(
compatibleHosts: Host[]
): Promise<RetryableOptions> {
async function createRetryableOptions(compatibleHosts: Host[]): Promise<RetryableOptions> {
const statefulHosts = await Promise.all(

@@ -54,3 +43,3 @@ compatibleHosts.map((compatibleHost) => {

});
})
}),
);

@@ -62,4 +51,3 @@ const hostsUp = statefulHosts.filter((host) => host.isUp());

const hostsAvailable = [...hostsUp, ...hostsTimedOut];
const compatibleHostsAvailable =
hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts;
const compatibleHostsAvailable = hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts;

@@ -81,5 +69,3 @@ return {

const timeoutMultiplier =
hostsTimedOut.length === 0 && timeoutsCount === 0
? 1
: hostsTimedOut.length + 3 + timeoutsCount;
hostsTimedOut.length === 0 && timeoutsCount === 0 ? 1 : hostsTimedOut.length + 3 + timeoutsCount;

@@ -94,3 +80,3 @@ return timeoutMultiplier * baseTimeout;

requestOptions: RequestOptions,
isRead = true
isRead = true,
): Promise<TResponse> {

@@ -103,7 +89,3 @@ const stackTrace: StackFrame[] = [];

const data = serializeData(request, requestOptions);
const headers = serializeHeaders(
baseHeaders,
request.headers,
requestOptions.headers
);
const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);

@@ -136,5 +118,3 @@ // On `GET`, the data is proxied to query parameters.

!requestOptions.queryParameters[key] ||
Object.prototype.toString.call(
requestOptions.queryParameters[key]
) === '[object Object]'
Object.prototype.toString.call(requestOptions.queryParameters[key]) === '[object Object]'
) {

@@ -152,3 +132,3 @@ queryParameters[key] = requestOptions.queryParameters[key];

retryableHosts: Host[],
getTimeout: (timeoutsCount: number, timeout: number) => number
getTimeout: (timeoutsCount: number, timeout: number) => number,
): Promise<TResponse> => {

@@ -163,3 +143,3 @@ /**

let responseTimeout = isRead ? requestOptions.timeouts?.read || timeouts.read : requestOptions.timeouts?.write || timeouts.write;
const timeout = { ...timeouts, ...requestOptions.timeouts };

@@ -171,4 +151,4 @@ const payload: EndRequest = {

url: serializeUrl(host, request.path, queryParameters),
connectTimeout: getTimeout(timeoutsCount, requestOptions.timeouts?.connect || timeouts.connect),
responseTimeout: getTimeout(timeoutsCount, responseTimeout),
connectTimeout: getTimeout(timeoutsCount, timeout.connect),
responseTimeout: getTimeout(timeoutsCount, isRead ? timeout.read : timeout.write),
};

@@ -209,6 +189,3 @@

// eslint-disable-next-line no-console -- this will be fixed by exposing a `logger` to the transporter
console.log(
'Retryable failure',
stackFrameWithoutCredentials(stackFrame)
);
console.log('Retryable failure', stackFrameWithoutCredentials(stackFrame));

@@ -220,6 +197,3 @@ /**

*/
await hostsCache.set(
host,
createStatefulHost(host, response.isTimedOut ? 'timed out' : 'down')
);
await hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? 'timed out' : 'down'));

@@ -246,5 +220,3 @@ return retry(retryableHosts, getTimeout);

const compatibleHosts = hosts.filter(
(host) =>
host.accept === 'readWrite' ||
(isRead ? host.accept === 'read' : host.accept === 'write')
(host) => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'),
);

@@ -256,6 +228,3 @@ const options = await createRetryableOptions(compatibleHosts);

function createRequest<TResponse>(
request: Request,
requestOptions: RequestOptions = {}
): Promise<TResponse> {
function createRequest<TResponse>(request: Request, requestOptions: RequestOptions = {}): Promise<TResponse> {
/**

@@ -333,6 +302,5 @@ * A read request is either a `GET` request, or a request that we make

(response) => Promise.all([requestsCache.delete(key), response]),
(err) =>
Promise.all([requestsCache.delete(key), Promise.reject(err)])
(err) => Promise.all([requestsCache.delete(key), Promise.reject(err)]),
)
.then(([_, response]) => response)
.then(([_, response]) => response),
);

@@ -347,3 +315,3 @@ },

miss: (response) => responsesCache.set(key, response),
}
},
);

@@ -350,0 +318,0 @@ }

@@ -30,3 +30,3 @@ import type { Response, StackFrame } from '../types';

stackTrace,
'RetryError'
'RetryError',
);

@@ -39,8 +39,3 @@ }

constructor(
message: string,
status: number,
stackTrace: StackFrame[],
name = 'ApiError'
) {
constructor(message: string, status: number, stackTrace: StackFrame[], name = 'ApiError') {
super(message, stackTrace, name);

@@ -80,8 +75,3 @@ this.status = status;

constructor(
message: string,
status: number,
error: DetailedError,
stackTrace: StackFrame[]
) {
constructor(message: string, status: number, error: DetailedError, stackTrace: StackFrame[]) {
super(message, status, stackTrace, 'DetailedApiError');

@@ -88,0 +78,0 @@ this.error = error;

@@ -1,10 +0,2 @@

import type {
Headers,
Host,
QueryParameters,
Request,
RequestOptions,
Response,
StackFrame,
} from '../types';
import type { Headers, Host, QueryParameters, Request, RequestOptions, Response, StackFrame } from '../types';

@@ -27,7 +19,3 @@ import { ApiError, DeserializationError, DetailedApiError } from './errors';

export function serializeUrl(
host: Host,
path: string,
queryParameters: QueryParameters
): string {
export function serializeUrl(host: Host, path: string, queryParameters: QueryParameters): string {
const queryParametersAsString = serializeQueryParameters(queryParameters);

@@ -54,4 +42,4 @@ let url = `${host.protocol}://${host.url}${host.port ? `:${host.port}` : ''}/${

? parameters[key].join(',')
: parameters[key]
).replaceAll('+', '%20')}`
: parameters[key],
).replaceAll('+', '%20')}`,
)

@@ -61,16 +49,8 @@ .join('&');

export function serializeData(
request: Request,
requestOptions: RequestOptions
): string | undefined {
if (
request.method === 'GET' ||
(request.data === undefined && requestOptions.data === undefined)
) {
export function serializeData(request: Request, requestOptions: RequestOptions): string | undefined {
if (request.method === 'GET' || (request.data === undefined && requestOptions.data === undefined)) {
return undefined;
}
const data = Array.isArray(request.data)
? request.data
: { ...request.data, ...requestOptions.data };
const data = Array.isArray(request.data) ? request.data : { ...request.data, ...requestOptions.data };

@@ -83,3 +63,3 @@ return JSON.stringify(data);

requestHeaders: Headers,
requestOptionsHeaders?: Headers
requestOptionsHeaders?: Headers,
): Headers {

@@ -110,18 +90,10 @@ const headers: Headers = {

export function deserializeFailure(
{ content, status }: Response,
stackFrame: StackFrame[]
): Error {
export function deserializeFailure({ content, status }: Response, stackFrame: StackFrame[]): Error {
try {
const parsed = JSON.parse(content);
if ('error' in parsed) {
return new DetailedApiError(
parsed.message,
status,
parsed.error,
stackFrame
);
return new DetailedApiError(parsed.message, status, parsed.error, stackFrame);
}
return new ApiError(parsed.message, status, stackFrame);
} catch (e) {
} catch {
// ..

@@ -128,0 +100,0 @@ }

import type { Response } from '../types';
export function isNetworkError({
isTimedOut,
status,
}: Omit<Response, 'content'>): boolean {
export function isNetworkError({ isTimedOut, status }: Omit<Response, 'content'>): boolean {
return !isTimedOut && ~~status === 0;
}
export function isRetryable({
isTimedOut,
status,
}: Omit<Response, 'content'>): boolean {
return (
isTimedOut ||
isNetworkError({ isTimedOut, status }) ||
(~~(status / 100) !== 2 && ~~(status / 100) !== 4)
);
export function isRetryable({ isTimedOut, status }: Omit<Response, 'content'>): boolean {
return isTimedOut || isNetworkError({ isTimedOut, status }) || (~~(status / 100) !== 2 && ~~(status / 100) !== 4);
}

@@ -20,0 +10,0 @@

import type { Headers, StackFrame } from '../types';
export function stackTraceWithoutCredentials(
stackTrace: StackFrame[]
): StackFrame[] {
return stackTrace.map((stackFrame) =>
stackFrameWithoutCredentials(stackFrame)
);
export function stackTraceWithoutCredentials(stackTrace: StackFrame[]): StackFrame[] {
return stackTrace.map((stackFrame) => stackFrameWithoutCredentials(stackFrame));
}
export function stackFrameWithoutCredentials(
stackFrame: StackFrame
): StackFrame {
const modifiedHeaders: Headers = stackFrame.request.headers[
'x-algolia-api-key'
]
export function stackFrameWithoutCredentials(stackFrame: StackFrame): StackFrame {
const modifiedHeaders: Headers = stackFrame.request.headers['x-algolia-api-key']
? { 'x-algolia-api-key': '*****' }

@@ -18,0 +10,0 @@ : {};

@@ -8,3 +8,3 @@ export type Cache = {

defaultValue: () => Promise<TValue>,
events?: CacheEvents<TValue>
events?: CacheEvents<TValue>,
) => Promise<TValue>;

@@ -15,6 +15,3 @@

*/
set: <TValue>(
key: Record<string, any> | string,
value: TValue
) => Promise<TValue>;
set: <TValue>(key: Record<string, any> | string, value: TValue) => Promise<TValue>;

@@ -21,0 +18,0 @@ /**

@@ -5,11 +5,5 @@ import type { AlgoliaAgentOptions, TransporterOptions } from './transporter';

type OverriddenTransporterOptions =
| 'baseHeaders'
| 'baseQueryParameters'
| 'hosts';
type OverriddenTransporterOptions = 'baseHeaders' | 'baseQueryParameters' | 'hosts';
export type CreateClientOptions = Omit<
TransporterOptions,
OverriddenTransporterOptions | 'algoliaAgent'
> &
export type CreateClientOptions = Omit<TransporterOptions, OverriddenTransporterOptions | 'algoliaAgent'> &
Partial<Pick<TransporterOptions, OverriddenTransporterOptions>> & {

@@ -22,4 +16,2 @@ appId: string;

export type ClientOptions = Partial<
Omit<CreateClientOptions, 'apiKey' | 'appId'>
>;
export type ClientOptions = Partial<Omit<CreateClientOptions, 'apiKey' | 'appId'>>;

@@ -149,6 +149,3 @@ import type { Cache } from './cache';

*/
request: <TResponse>(
baseRequest: Request,
baseRequestOptions?: RequestOptions
) => Promise<TResponse>;
request: <TResponse>(baseRequest: Request, baseRequestOptions?: RequestOptions) => Promise<TResponse>;
};