@supernova-studio/model 0.54.23 → 0.54.24
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/utils/common.ts +6 -2
package/dist/index.mjs
CHANGED
|
@@ -792,10 +792,10 @@ function buildConstantEnum(values) {
|
|
|
792
792
|
const constMap = values.reduce((acc, code) => ({ ...acc, [code]: code }), {});
|
|
793
793
|
return constMap;
|
|
794
794
|
}
|
|
795
|
-
async function promiseWithTimeout(timeoutMs, promise) {
|
|
795
|
+
async function promiseWithTimeout(timeoutMs, promise, onTimeout) {
|
|
796
796
|
let timeoutHandle;
|
|
797
797
|
const timeoutPromise = new Promise((_, reject) => {
|
|
798
|
-
timeoutHandle = setTimeout(() => reject(SupernovaException.timeout()), timeoutMs);
|
|
798
|
+
timeoutHandle = setTimeout(() => reject(onTimeout?.() ?? SupernovaException.timeout()), timeoutMs);
|
|
799
799
|
});
|
|
800
800
|
const result = await Promise.race([promise(), timeoutPromise]);
|
|
801
801
|
clearTimeout(timeoutHandle);
|