@algolia/client-common 5.0.0-alpha.111 → 5.0.0-alpha.113

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.
@@ -566,16 +566,13 @@ function createTransporter({
566
566
  if (host === undefined) {
567
567
  throw new RetryError(stackTraceWithoutCredentials(stackTrace));
568
568
  }
569
- let responseTimeout = requestOptions.timeout;
570
- if (responseTimeout === undefined) {
571
- responseTimeout = isRead ? timeouts.read : timeouts.write;
572
- }
569
+ let responseTimeout = isRead ? requestOptions.timeouts?.read || timeouts.read : requestOptions.timeouts?.write || timeouts.write;
573
570
  const payload = {
574
571
  data,
575
572
  headers,
576
573
  method: request.method,
577
574
  url: serializeUrl(host, request.path, queryParameters),
578
- connectTimeout: getTimeout(timeoutsCount, timeouts.connect),
575
+ connectTimeout: getTimeout(timeoutsCount, requestOptions.timeouts?.connect || timeouts.connect),
579
576
  responseTimeout: getTimeout(timeoutsCount, responseTimeout)
580
577
  };
581
578
  /**
@@ -564,16 +564,13 @@ function createTransporter({
564
564
  if (host === undefined) {
565
565
  throw new RetryError(stackTraceWithoutCredentials(stackTrace));
566
566
  }
567
- let responseTimeout = requestOptions.timeout;
568
- if (responseTimeout === undefined) {
569
- responseTimeout = isRead ? timeouts.read : timeouts.write;
570
- }
567
+ let responseTimeout = isRead ? requestOptions.timeouts?.read || timeouts.read : requestOptions.timeouts?.write || timeouts.write;
571
568
  const payload = {
572
569
  data,
573
570
  headers,
574
571
  method: request.method,
575
572
  url: serializeUrl(host, request.path, queryParameters),
576
- connectTimeout: getTimeout(timeoutsCount, timeouts.connect),
573
+ connectTimeout: getTimeout(timeoutsCount, requestOptions.timeouts?.connect || timeouts.connect),
577
574
  responseTimeout: getTimeout(timeoutsCount, responseTimeout)
578
575
  };
579
576
  /**
@@ -1 +1 @@
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,CAmTlC"}
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"}
@@ -9,7 +9,7 @@ export type RequestOptions = Pick<Request, 'cacheable'> & {
9
9
  * the given timeout will be applied. But the transporter layer may
10
10
  * increase this timeout if there is need for it.
11
11
  */
12
- timeout?: number;
12
+ timeouts?: Partial<Timeouts>;
13
13
  /**
14
14
  * Custom headers for the request. This headers are
15
15
  * going to be merged the transporter headers.
@@ -1 +1 @@
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,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7C,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAElD,MAAM,MAAM,cAAc,GA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S,CAAC,CAAC;CACzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/client-common",
3
- "version": "5.0.0-alpha.111",
3
+ "version": "5.0.0-alpha.113",
4
4
  "description": "Common package for the Algolia JavaScript API client.",
5
5
  "repository": "algolia/algoliasearch-client-javascript",
6
6
  "license": "MIT",
@@ -20,14 +20,14 @@
20
20
  "test": "jest"
21
21
  },
22
22
  "devDependencies": {
23
- "@babel/preset-env": "7.24.3",
23
+ "@babel/preset-env": "7.24.4",
24
24
  "@babel/preset-typescript": "7.24.1",
25
25
  "@types/jest": "29.5.12",
26
- "@types/node": "20.11.30",
26
+ "@types/node": "20.12.7",
27
27
  "jest": "29.7.0",
28
28
  "jest-environment-jsdom": "29.7.0",
29
29
  "ts-jest": "29.1.2",
30
- "typescript": "5.4.3"
30
+ "typescript": "5.4.5"
31
31
  },
32
32
  "engines": {
33
33
  "node": ">= 14.0.0"
@@ -151,17 +151,14 @@ export function createTransporter({
151
151
  throw new RetryError(stackTraceWithoutCredentials(stackTrace));
152
152
  }
153
153
 
154
- let responseTimeout = requestOptions.timeout;
155
- if (responseTimeout === undefined) {
156
- responseTimeout = isRead ? timeouts.read : timeouts.write;
157
- }
154
+ let responseTimeout = isRead ? requestOptions.timeouts?.read || timeouts.read : requestOptions.timeouts?.write || timeouts.write;
158
155
 
159
156
  const payload: EndRequest = {
160
157
  data,
161
158
  headers,
162
159
  method: request.method,
163
160
  url: serializeUrl(host, request.path, queryParameters),
164
- connectTimeout: getTimeout(timeoutsCount, timeouts.connect),
161
+ connectTimeout: getTimeout(timeoutsCount, requestOptions.timeouts?.connect || timeouts.connect),
165
162
  responseTimeout: getTimeout(timeoutsCount, responseTimeout),
166
163
  };
167
164
 
@@ -11,7 +11,7 @@ export type RequestOptions = Pick<Request, 'cacheable'> & {
11
11
  * the given timeout will be applied. But the transporter layer may
12
12
  * increase this timeout if there is need for it.
13
13
  */
14
- timeout?: number;
14
+ timeouts?: Partial<Timeouts>;
15
15
 
16
16
  /**
17
17
  * Custom headers for the request. This headers are