@dynamic-labs/utils 2.0.0-alpha.23 → 2.0.0-alpha.25
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 +33 -0
- package/package.json +3 -3
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/runSafe/index.d.ts +1 -0
- package/src/runSafe/runSafe.cjs +24 -0
- package/src/runSafe/runSafe.d.ts +8 -0
- package/src/runSafe/runSafe.js +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.0.0-alpha.25](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.24...v2.0.0-alpha.25) (2024-04-04)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add in-app browser deeplink for metamask ([#5176](https://github.com/dynamic-labs/DynamicAuth/issues/5176)) ([02ce607](https://github.com/dynamic-labs/DynamicAuth/commit/02ce6077ed0deeaefc7a62ee91ff72f5bce2b327)), closes [#5123](https://github.com/dynamic-labs/DynamicAuth/issues/5123)
|
|
8
|
+
|
|
9
|
+
## [2.0.0-alpha.24](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.23...v2.0.0-alpha.24) (2024-04-03)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### ⚠ BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
* rename otp verification callbacks (#5180)
|
|
15
|
+
* remove deprecated isVerificationInProgress flag and setter (#5089)
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* allow creating embedded wallets even if user signs in with a wallet ([#5093](https://github.com/dynamic-labs/DynamicAuth/issues/5093)) ([ba2dd62](https://github.com/dynamic-labs/DynamicAuth/commit/ba2dd625e0a7bf35018cf8aac8e80bd23b4e3b0f))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* api unit test by removing api and sdk versions for assertion ([#5168](https://github.com/dynamic-labs/DynamicAuth/issues/5168)) ([6d3b8ad](https://github.com/dynamic-labs/DynamicAuth/commit/6d3b8adebe62a4f2a7878630384348b2c491d779))
|
|
25
|
+
* bug when phone input is empty ([#5139](https://github.com/dynamic-labs/DynamicAuth/issues/5139)) ([7155b63](https://github.com/dynamic-labs/DynamicAuth/commit/7155b63518d00ba807bc321c6740b341d0a8b82f))
|
|
26
|
+
* clear error message on otp resend for sms ([#5182](https://github.com/dynamic-labs/DynamicAuth/issues/5182)) ([f40b48c](https://github.com/dynamic-labs/DynamicAuth/commit/f40b48c7f58c8e3dfe73fb124d642c3b8f193cee))
|
|
27
|
+
* link farcaster account ([#5170](https://github.com/dynamic-labs/DynamicAuth/issues/5170)) ([10fe272](https://github.com/dynamic-labs/DynamicAuth/commit/10fe272247605b5f09385f063231e2c881399cc8))
|
|
28
|
+
* show correct otp message for sms verification failure ([#5177](https://github.com/dynamic-labs/DynamicAuth/issues/5177)) ([b3bcd76](https://github.com/dynamic-labs/DynamicAuth/commit/b3bcd7694047dac55ce37babb71684a418633f95))
|
|
29
|
+
* update wagmi connector id when wallet connector changes ([#5185](https://github.com/dynamic-labs/DynamicAuth/issues/5185)) ([14fb83a](https://github.com/dynamic-labs/DynamicAuth/commit/14fb83a22c8e39095b79cc9951cae3f00f4fca2f))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
* remove deprecated isVerificationInProgress flag and setter ([#5089](https://github.com/dynamic-labs/DynamicAuth/issues/5089)) ([060fef7](https://github.com/dynamic-labs/DynamicAuth/commit/060fef70df0c497e7a9b6e67ad0bfafef52c2bbb))
|
|
33
|
+
* rename otp verification callbacks ([#5180](https://github.com/dynamic-labs/DynamicAuth/issues/5180)) ([a580eec](https://github.com/dynamic-labs/DynamicAuth/commit/a580eec02d15b46a25c01d5473e4db2db89937e2))
|
|
34
|
+
|
|
2
35
|
## [2.0.0-alpha.23](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.22...v2.0.0-alpha.23) (2024-04-01)
|
|
3
36
|
|
|
4
37
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/utils",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.25",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"tldts": "6.0.16",
|
|
30
|
-
"@dynamic-labs/logger": "2.0.0-alpha.
|
|
31
|
-
"@dynamic-labs/types": "2.0.0-alpha.
|
|
30
|
+
"@dynamic-labs/logger": "2.0.0-alpha.25",
|
|
31
|
+
"@dynamic-labs/types": "2.0.0-alpha.25"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"viem": "^2.7.6"
|
package/src/index.cjs
CHANGED
|
@@ -47,6 +47,7 @@ var pipe = require('./pipe/pipe.cjs');
|
|
|
47
47
|
var formatNumberText = require('./formatNumberText/formatNumberText.cjs');
|
|
48
48
|
var ceil = require('./ceil/ceil.cjs');
|
|
49
49
|
var trimEnd = require('./trimEnd/trimEnd.cjs');
|
|
50
|
+
var runSafe = require('./runSafe/runSafe.cjs');
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
|
|
@@ -109,3 +110,4 @@ exports.pipe = pipe.pipe;
|
|
|
109
110
|
exports.formatNumberText = formatNumberText.formatNumberText;
|
|
110
111
|
exports.ceil = ceil.ceil;
|
|
111
112
|
exports.trimEnd = trimEnd.trimEnd;
|
|
113
|
+
exports.runSafe = runSafe.runSafe;
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { runSafe } from './runSafe';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Safely executes a callback function.
|
|
9
|
+
* @template T The type of the callback's return value.
|
|
10
|
+
* @template E The type of the error.
|
|
11
|
+
* @param {() => Promise<T> | T} callback A function that might throw an error.
|
|
12
|
+
* @returns {Promise<[T | undefined, E | undefined]>} A tuple with either the result or the error.
|
|
13
|
+
*/
|
|
14
|
+
const runSafe = (callback) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
try {
|
|
16
|
+
const resolved = yield callback();
|
|
17
|
+
return [resolved, undefined];
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return [undefined, error];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
exports.runSafe = runSafe;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safely executes a callback function.
|
|
3
|
+
* @template T The type of the callback's return value.
|
|
4
|
+
* @template E The type of the error.
|
|
5
|
+
* @param {() => Promise<T> | T} callback A function that might throw an error.
|
|
6
|
+
* @returns {Promise<[T | undefined, E | undefined]>} A tuple with either the result or the error.
|
|
7
|
+
*/
|
|
8
|
+
export declare const runSafe: <T, E>(callback: () => T | Promise<T>) => Promise<[T | undefined, E | undefined]>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Safely executes a callback function.
|
|
5
|
+
* @template T The type of the callback's return value.
|
|
6
|
+
* @template E The type of the error.
|
|
7
|
+
* @param {() => Promise<T> | T} callback A function that might throw an error.
|
|
8
|
+
* @returns {Promise<[T | undefined, E | undefined]>} A tuple with either the result or the error.
|
|
9
|
+
*/
|
|
10
|
+
const runSafe = (callback) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
try {
|
|
12
|
+
const resolved = yield callback();
|
|
13
|
+
return [resolved, undefined];
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
return [undefined, error];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export { runSafe };
|