@supernova-studio/model 0.54.22 → 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.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);