@dynamic-labs/utils 4.0.0-alpha.1 → 4.0.0-alpha.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/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
1
 
2
+ ## [4.0.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.1...v4.0.0-alpha.2) (2024-09-18)
3
+
4
+
5
+ ### Features
6
+
7
+ * add iconVariant prop to DynamicBridgeWidget ([#6915](https://github.com/dynamic-labs/DynamicAuth/issues/6915)) ([8aa0f3d](https://github.com/dynamic-labs/DynamicAuth/commit/8aa0f3d8d8c41c7b5c4796106f611f208010cb6d))
8
+ * allow to create extra embedded wallets in react-native ([#6923](https://github.com/dynamic-labs/DynamicAuth/issues/6923)) ([ba22f7b](https://github.com/dynamic-labs/DynamicAuth/commit/ba22f7bcf41a444a4df0aff9b6aec257457e9402))
9
+ * **client:** add hide method for auth and userProfile ui modules ([#6928](https://github.com/dynamic-labs/DynamicAuth/issues/6928)) ([a11a4a5](https://github.com/dynamic-labs/DynamicAuth/commit/a11a4a5d6e25ce2a916ebd52f0b341020dc1a7e5))
10
+
2
11
  ## [4.0.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.0...v4.0.0-alpha.1) (2024-09-17)
3
12
 
4
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "4.0.0-alpha.1",
3
+ "version": "4.0.0-alpha.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -28,8 +28,8 @@
28
28
  "dependencies": {
29
29
  "@dynamic-labs/sdk-api-core": "0.0.530",
30
30
  "tldts": "6.0.16",
31
- "@dynamic-labs/logger": "4.0.0-alpha.1",
32
- "@dynamic-labs/types": "4.0.0-alpha.1",
31
+ "@dynamic-labs/logger": "4.0.0-alpha.2",
32
+ "@dynamic-labs/types": "4.0.0-alpha.2",
33
33
  "buffer": "6.0.3",
34
34
  "eventemitter3": "5.0.1",
35
35
  "stream": "0.0.2"
package/src/index.cjs CHANGED
@@ -76,6 +76,7 @@ var isHex = require('./isHex/isHex.cjs');
76
76
  var StorageService = require('./services/StorageService/StorageService.cjs');
77
77
  var createStorageService = require('./services/StorageService/createStorageService/createStorageService.cjs');
78
78
  var cloneObjectWithOverrides = require('./cloneObjectWithOverrides/cloneObjectWithOverrides.cjs');
79
+ var promiseWithTimeout = require('./promiseWithTimeout/promiseWithTimeout.cjs');
79
80
 
80
81
 
81
82
 
@@ -166,3 +167,4 @@ exports.isHex = isHex.isHex;
166
167
  exports.StorageService = StorageService.StorageService;
167
168
  exports.createStorageService = createStorageService.createStorageService;
168
169
  exports.cloneObjectWithOverrides = cloneObjectWithOverrides.cloneObjectWithOverrides;
170
+ exports.promiseWithTimeout = promiseWithTimeout.promiseWithTimeout;
package/src/index.d.ts CHANGED
@@ -32,3 +32,4 @@ export { hexToString } from './hexToString';
32
32
  export { isHex } from './isHex';
33
33
  export { type IStorageService, type StorageOptions, StorageService, createStorageService, } from './services/StorageService';
34
34
  export { cloneObjectWithOverrides } from './cloneObjectWithOverrides';
35
+ export { promiseWithTimeout } from './promiseWithTimeout';
package/src/index.js CHANGED
@@ -72,3 +72,4 @@ export { isHex } from './isHex/isHex.js';
72
72
  export { StorageService } from './services/StorageService/StorageService.js';
73
73
  export { createStorageService } from './services/StorageService/createStorageService/createStorageService.js';
74
74
  export { cloneObjectWithOverrides } from './cloneObjectWithOverrides/cloneObjectWithOverrides.js';
75
+ export { promiseWithTimeout } from './promiseWithTimeout/promiseWithTimeout.js';
@@ -0,0 +1 @@
1
+ export { promiseWithTimeout } from './promiseWithTimeout';
@@ -0,0 +1,19 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const promiseWithTimeout = (promise, ms, { timeoutMessage = 'Operation timed out' } = {}) => {
7
+ let timerId;
8
+ const timeoutPromise = new Promise((_, reject) => {
9
+ timerId = setTimeout(() => {
10
+ reject(new Error(timeoutMessage));
11
+ }, ms);
12
+ });
13
+ const wrappedPromise = promise.finally(() => {
14
+ clearTimeout(timerId);
15
+ });
16
+ return Promise.race([wrappedPromise, timeoutPromise]);
17
+ };
18
+
19
+ exports.promiseWithTimeout = promiseWithTimeout;
@@ -0,0 +1,5 @@
1
+ type PromiseWithTimeoutOptions = {
2
+ timeoutMessage?: string;
3
+ };
4
+ export declare const promiseWithTimeout: <T>(promise: Promise<T>, ms: number, { timeoutMessage }?: PromiseWithTimeoutOptions) => Promise<T>;
5
+ export {};
@@ -0,0 +1,15 @@
1
+ 'use client'
2
+ const promiseWithTimeout = (promise, ms, { timeoutMessage = 'Operation timed out' } = {}) => {
3
+ let timerId;
4
+ const timeoutPromise = new Promise((_, reject) => {
5
+ timerId = setTimeout(() => {
6
+ reject(new Error(timeoutMessage));
7
+ }, ms);
8
+ });
9
+ const wrappedPromise = promise.finally(() => {
10
+ clearTimeout(timerId);
11
+ });
12
+ return Promise.race([wrappedPromise, timeoutPromise]);
13
+ };
14
+
15
+ export { promiseWithTimeout };