Template base para proyectos SaaS multi-tenant. Estructura inicial: - apps/backend (NestJS API) - apps/frontend (React/Vite) - apps/database (PostgreSQL DDL) - docs/ (Documentación) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
31 lines
920 B
JavaScript
31 lines
920 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.promiseTimeout = exports.TimeoutError = void 0;
|
|
/**
|
|
* An errors which gets raised when the timeout
|
|
* exceeded
|
|
*
|
|
* @internal
|
|
*/
|
|
class TimeoutError extends Error {
|
|
}
|
|
exports.TimeoutError = TimeoutError;
|
|
/**
|
|
* Executes a promise in the given timeout. If the promise
|
|
* does not finish in the given timeout, it will
|
|
* raise a TimeoutError
|
|
*
|
|
* @param {number} ms The timeout in milliseconds
|
|
* @param {Promise<any>} promise The promise which should get executed
|
|
*
|
|
* @internal
|
|
*/
|
|
const promiseTimeout = (ms, promise) => {
|
|
let timer;
|
|
return Promise.race([
|
|
promise,
|
|
new Promise((_, reject) => (timer = setTimeout(() => reject(new TimeoutError(`Timed out in ${ms}ms.`)), ms))),
|
|
]).finally(() => clearTimeout(timer));
|
|
};
|
|
exports.promiseTimeout = promiseTimeout;
|
|
//# sourceMappingURL=promise-timeout.js.map
|