@finatic/client 0.9.4 → 0.9.5

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/dist/index.mjs CHANGED
@@ -42,6 +42,13 @@ async function retryApiCall(fn, options = {}, config) {
42
42
  retryOnNetworkError: config?.retryOnNetworkError ?? options.retryOnNetworkError ?? true,
43
43
  onFailedAttempt: options.onFailedAttempt,
44
44
  };
45
+ const pRetryOptions = {
46
+ retries: opts.maxRetries,
47
+ minTimeout: opts.retryDelay,
48
+ maxTimeout: opts.retryMaxDelay,
49
+ factor: opts.retryMultiplier,
50
+ ...(opts.onFailedAttempt && { onFailedAttempt: opts.onFailedAttempt }),
51
+ };
45
52
  return await pRetry(async () => {
46
53
  try {
47
54
  return await fn();
@@ -60,13 +67,7 @@ async function retryApiCall(fn, options = {}, config) {
60
67
  // Re-throw to trigger retry
61
68
  throw error;
62
69
  }
63
- }, {
64
- retries: opts.maxRetries,
65
- minTimeout: opts.retryDelay,
66
- maxTimeout: opts.retryMaxDelay,
67
- factor: opts.retryMultiplier,
68
- onFailedAttempt: opts.onFailedAttempt,
69
- });
70
+ }, pRetryOptions);
70
71
  }
71
72
 
72
73
  /**
@@ -4524,7 +4525,7 @@ function validateParams(schema, params, config) {
4524
4525
  }
4525
4526
  catch (error) {
4526
4527
  if (error instanceof z.ZodError) {
4527
- const message = `Validation failed: ${error.errors.map((e) => `${e.path.join('.')}: ${e.message}`).join(', ')}`;
4528
+ const message = `Validation failed: ${error.issues.map((e) => `${e.path.join('.')}: ${e.message}`).join(', ')}`;
4528
4529
  if (config?.validationStrict) {
4529
4530
  throw new ValidationError(message);
4530
4531
  }
@@ -6700,7 +6701,7 @@ let FinaticConnect$1 = class FinaticConnect extends EventEmitter {
6700
6701
  logger.debug?.('Creating new FinaticConnect instance');
6701
6702
  const connectOptions = {
6702
6703
  token,
6703
- sdkConfig: sdkConfig,
6704
+ ...(sdkConfig !== undefined && { sdkConfig }),
6704
6705
  };
6705
6706
  instance = new FinaticConnect(connectOptions);
6706
6707
  baseClass.instance = instance;