@aligent/microservice-util-lib 1.3.0 → 1.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aligent/microservice-util-lib",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "A set of utility functions for Aligent Microservices",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -204,8 +204,10 @@ async function performRetries(config, context) {
204
204
  await config.onRetry({ ...context, attempt, response });
205
205
  }
206
206
  try {
207
- const signal = config.shouldResetTimeout ? undefined : context.request.signal;
208
- response = await config.fetch(new Request(context.request, { signal }));
207
+ const request = config.shouldResetTimeout
208
+ ? new Request(context.request)
209
+ : new Request(context.request, { signal: context.request.signal });
210
+ response = await config.fetch(request);
209
211
  context = { ...context, attempt: attempt + 1, response, error: null };
210
212
  attempt++;
211
213
  }
@@ -33,7 +33,11 @@ type GetKeyType<Key extends string, O extends {
33
33
  * Given an ObjectMap, return a new ObjectMap with the first index of each
34
34
  * tuple replaced with the value of the second index
35
35
  */
36
- type OverrideIndex<M extends ObjectMap[number], V extends string> = readonly [M[0], V, M[2]];
36
+ type OverrideIndex<M extends ObjectMap[number], V extends string> = M extends readonly [
37
+ unknown,
38
+ unknown,
39
+ infer T
40
+ ] ? readonly [M[0], V, T] : readonly [M[0], V];
37
41
  /**
38
42
  * Given a key and a base object, return the type of the property referencable
39
43
  * by the key on the base object
@@ -48,7 +52,7 @@ type OverrideIndex<M extends ObjectMap[number], V extends string> = readonly [M[
48
52
  */
49
53
  type ConstructTypeFromPropertiesInternal<M extends ObjectMap[number], O extends {
50
54
  [key: string]: any;
51
- }> = M[1] extends `${infer P}.${infer Rest}` ? {
55
+ }> = M[1] extends `${infer P extends string}.${infer Rest extends string}` ? {
52
56
  [key in P]: ConstructTypeFromPropertiesInternal<OverrideIndex<M, Rest>, O>;
53
57
  } : {
54
58
  [key in M[1]]: GetKeyType<M[0], O, M>;