@dynamic-labs/utils 4.0.0-alpha.43 → 4.0.0-alpha.45

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/CHANGELOG.md CHANGED
@@ -1,4 +1,31 @@
1
1
 
2
+ ## [4.0.0-alpha.45](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.44...v4.0.0-alpha.45) (2024-12-11)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * don't throw error if wallet no found in walletbook when fetching metadata ([#7579](https://github.com/dynamic-labs/dynamic-auth/issues/7579)) ([93074a1](https://github.com/dynamic-labs/dynamic-auth/commit/93074a11da1b843cd44ad986c7cfd1f243f2a65d))
8
+
9
+ ## [4.0.0-alpha.44](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.43...v4.0.0-alpha.44) (2024-12-09)
10
+
11
+
12
+ ### ⚠ BREAKING CHANGES
13
+
14
+ * Removes the `eventsCallbacks` prop which has been deprecated for a while. Use the `events` prop instead.
15
+
16
+ ### Features
17
+
18
+ * allows changing the storage postfix ([#7558](https://github.com/dynamic-labs/dynamic-auth/issues/7558)) ([f0aac70](https://github.com/dynamic-labs/dynamic-auth/commit/f0aac703732a69615f11876023684509ad87af62))
19
+ * allows filtering tokens ([#7561](https://github.com/dynamic-labs/dynamic-auth/issues/7561)) ([e73b56c](https://github.com/dynamic-labs/dynamic-auth/commit/e73b56cd41ead7e4f693d19ccb2670602d1107c5))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * fetch and store public key for onekey btc wallet ([#7577](https://github.com/dynamic-labs/dynamic-auth/issues/7577)) ([634e7ac](https://github.com/dynamic-labs/dynamic-auth/commit/634e7ac40dcbe6780f7b52f2aaf6b0a90f1e7325))
25
+
26
+
27
+ * remove eventsCallbacks ([#7571](https://github.com/dynamic-labs/dynamic-auth/issues/7571)) ([7006db3](https://github.com/dynamic-labs/dynamic-auth/commit/7006db3f23ee87b23b075941e16d216d1b8bc356))
28
+
2
29
  ## [4.0.0-alpha.43](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.42...v4.0.0-alpha.43) (2024-12-09)
3
30
 
4
31
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.0.0-alpha.43";
6
+ var version = "4.0.0-alpha.45";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.0.0-alpha.43";
2
+ var version = "4.0.0-alpha.45";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "4.0.0-alpha.43",
3
+ "version": "4.0.0-alpha.45",
4
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@dynamic-labs/sdk-api-core": "0.0.570",
22
22
  "tldts": "6.0.16",
23
- "@dynamic-labs/assert-package-version": "4.0.0-alpha.43",
24
- "@dynamic-labs/logger": "4.0.0-alpha.43",
25
- "@dynamic-labs/types": "4.0.0-alpha.43",
23
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.45",
24
+ "@dynamic-labs/logger": "4.0.0-alpha.45",
25
+ "@dynamic-labs/types": "4.0.0-alpha.45",
26
26
  "buffer": "6.0.3",
27
27
  "eventemitter3": "5.0.1"
28
28
  },
@@ -8,14 +8,7 @@ var sleep = require('../sleep/sleep.cjs');
8
8
 
9
9
  const FALLBACK_UNDEFINED = 'FALLBACK_UNDEFINED';
10
10
  const retryableFn = (fn_1, ...args_1) => _tslib.__awaiter(void 0, [fn_1, ...args_1], void 0, function* (fn, options = {}) {
11
- const { maxRetries = 3, currentRetry = 0, timeoutMs = 100, fallbackValue = new Error('Max retries reached'), retryStrategy = 'timeout-only', retryIntervalMs = 0, logger, } = options;
12
- logger === null || logger === void 0 ? void 0 : logger.debug('Configured retryableFn with options: ', {
13
- currentRetry,
14
- fallbackValue,
15
- maxRetries,
16
- retryStrategy,
17
- timeoutMs,
18
- });
11
+ const { maxRetries = 3, currentRetry = 0, timeoutMs = 100, fallbackValue = new Error('Max retries reached'), retryStrategy = 'timeout-only', retryIntervalMs = 0, } = options;
19
12
  const timeoutPromise = new Promise((_, reject) => {
20
13
  setTimeout(() => {
21
14
  reject(new Error('Timeout'));
@@ -26,9 +19,7 @@ const retryableFn = (fn_1, ...args_1) => _tslib.__awaiter(void 0, [fn_1, ...args
26
19
  return result;
27
20
  }
28
21
  catch (err) {
29
- logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn caught error: ', err);
30
22
  if (currentRetry >= maxRetries) {
31
- logger === null || logger === void 0 ? void 0 : logger.error('Error while retrying function, returning/throwing fallback value', err, fallbackValue);
32
23
  if (fallbackValue instanceof Error) {
33
24
  throw fallbackValue;
34
25
  }
@@ -41,18 +32,13 @@ const retryableFn = (fn_1, ...args_1) => _tslib.__awaiter(void 0, [fn_1, ...args
41
32
  const shouldRetry = retryStrategy === 'timeout-and-rejection' ||
42
33
  (retryStrategy === 'timeout-only' && isTimeout) ||
43
34
  (retryStrategy === 'rejection-only' && !isTimeout);
44
- logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn shouldRetry: ', shouldRetry);
45
35
  if (!shouldRetry) {
46
36
  if (fallbackValue instanceof Error) {
47
- logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn throwing fallbackValue error: ', fallbackValue);
48
37
  throw err;
49
38
  }
50
39
  else if (fallbackValue === FALLBACK_UNDEFINED) {
51
- logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn returning undefined');
52
40
  return undefined;
53
41
  }
54
- logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn returning fallbackValue: ', fallbackValue);
55
- logger === null || logger === void 0 ? void 0 : logger.error('Error while retrying function, returning fallback value', err);
56
42
  return fallbackValue;
57
43
  }
58
44
  if (retryIntervalMs)
@@ -60,7 +46,6 @@ const retryableFn = (fn_1, ...args_1) => _tslib.__awaiter(void 0, [fn_1, ...args
60
46
  return retryableFn(fn, {
61
47
  currentRetry: currentRetry + 1,
62
48
  fallbackValue,
63
- logger,
64
49
  maxRetries,
65
50
  retryIntervalMs,
66
51
  retryStrategy,
@@ -1,4 +1,3 @@
1
- import { Logger } from '@dynamic-labs/logger';
2
1
  export declare const FALLBACK_UNDEFINED = "FALLBACK_UNDEFINED";
3
2
  export type RetryableFnOptions<T> = {
4
3
  /** Maximum number of retry attempts before returning fallbackValue */
@@ -11,8 +10,6 @@ export type RetryableFnOptions<T> = {
11
10
  fallbackValue?: T | Error | typeof FALLBACK_UNDEFINED;
12
11
  /** Configure whether the fn should be retried only on timeout, only on rejection, or both */
13
12
  retryStrategy?: 'timeout-only' | 'rejection-only' | 'timeout-and-rejection';
14
- /** Set the logger to be used */
15
- logger?: Logger | typeof console;
16
13
  /** Ms to wait before a retry */
17
14
  retryIntervalMs?: number;
18
15
  };
@@ -4,14 +4,7 @@ import { sleep } from '../sleep/sleep.js';
4
4
 
5
5
  const FALLBACK_UNDEFINED = 'FALLBACK_UNDEFINED';
6
6
  const retryableFn = (fn_1, ...args_1) => __awaiter(void 0, [fn_1, ...args_1], void 0, function* (fn, options = {}) {
7
- const { maxRetries = 3, currentRetry = 0, timeoutMs = 100, fallbackValue = new Error('Max retries reached'), retryStrategy = 'timeout-only', retryIntervalMs = 0, logger, } = options;
8
- logger === null || logger === void 0 ? void 0 : logger.debug('Configured retryableFn with options: ', {
9
- currentRetry,
10
- fallbackValue,
11
- maxRetries,
12
- retryStrategy,
13
- timeoutMs,
14
- });
7
+ const { maxRetries = 3, currentRetry = 0, timeoutMs = 100, fallbackValue = new Error('Max retries reached'), retryStrategy = 'timeout-only', retryIntervalMs = 0, } = options;
15
8
  const timeoutPromise = new Promise((_, reject) => {
16
9
  setTimeout(() => {
17
10
  reject(new Error('Timeout'));
@@ -22,9 +15,7 @@ const retryableFn = (fn_1, ...args_1) => __awaiter(void 0, [fn_1, ...args_1], vo
22
15
  return result;
23
16
  }
24
17
  catch (err) {
25
- logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn caught error: ', err);
26
18
  if (currentRetry >= maxRetries) {
27
- logger === null || logger === void 0 ? void 0 : logger.error('Error while retrying function, returning/throwing fallback value', err, fallbackValue);
28
19
  if (fallbackValue instanceof Error) {
29
20
  throw fallbackValue;
30
21
  }
@@ -37,18 +28,13 @@ const retryableFn = (fn_1, ...args_1) => __awaiter(void 0, [fn_1, ...args_1], vo
37
28
  const shouldRetry = retryStrategy === 'timeout-and-rejection' ||
38
29
  (retryStrategy === 'timeout-only' && isTimeout) ||
39
30
  (retryStrategy === 'rejection-only' && !isTimeout);
40
- logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn shouldRetry: ', shouldRetry);
41
31
  if (!shouldRetry) {
42
32
  if (fallbackValue instanceof Error) {
43
- logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn throwing fallbackValue error: ', fallbackValue);
44
33
  throw err;
45
34
  }
46
35
  else if (fallbackValue === FALLBACK_UNDEFINED) {
47
- logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn returning undefined');
48
36
  return undefined;
49
37
  }
50
- logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn returning fallbackValue: ', fallbackValue);
51
- logger === null || logger === void 0 ? void 0 : logger.error('Error while retrying function, returning fallback value', err);
52
38
  return fallbackValue;
53
39
  }
54
40
  if (retryIntervalMs)
@@ -56,7 +42,6 @@ const retryableFn = (fn_1, ...args_1) => __awaiter(void 0, [fn_1, ...args_1], vo
56
42
  return retryableFn(fn, {
57
43
  currentRetry: currentRetry + 1,
58
44
  fallbackValue,
59
- logger,
60
45
  maxRetries,
61
46
  retryIntervalMs,
62
47
  retryStrategy,