GOOD SHELL MAS BOY
Server: Apache/2.4.52 (Ubuntu)
System: Linux vmi1836763.contaboserver.net 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64
User: www-data (33)
PHP: 8.4.10
Disabled: NONE
Upload Files
File: //usr/local/lib/node_modules/firebase-tools/lib/hosting/expireUtils.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateChannelExpireTTL = exports.DEFAULT_DURATION = exports.MAX_DURATION = exports.Duration = exports.DURATION_REGEX = void 0;
const error_1 = require("../error");
exports.DURATION_REGEX = /^(\d+)([hdm])$/;
var Duration;
(function (Duration) {
    Duration[Duration["MINUTE"] = 60000] = "MINUTE";
    Duration[Duration["HOUR"] = 3600000] = "HOUR";
    Duration[Duration["DAY"] = 86400000] = "DAY";
})(Duration = exports.Duration || (exports.Duration = {}));
const DURATIONS = {
    m: Duration.MINUTE,
    h: Duration.HOUR,
    d: Duration.DAY,
};
exports.MAX_DURATION = 30 * Duration.DAY;
exports.DEFAULT_DURATION = 7 * Duration.DAY;
function calculateChannelExpireTTL(flag) {
    const match = exports.DURATION_REGEX.exec(flag);
    if (!match) {
        throw new error_1.FirebaseError(`"expires" flag must be a duration string (e.g. 24h or 7d) at most 30d`);
    }
    const d = parseInt(match[1], 10) * DURATIONS[match[2]];
    if (isNaN(d)) {
        throw new error_1.FirebaseError(`Failed to parse provided expire time "${flag}"`);
    }
    if (d > exports.MAX_DURATION) {
        throw new error_1.FirebaseError(`"expires" flag may not be longer than 30d`);
    }
    return d;
}
exports.calculateChannelExpireTTL = calculateChannelExpireTTL;