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/firestore/backupUtils.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateRetention = exports.Duration = exports.DURATION_REGEX = void 0;
const error_1 = require("../error");
exports.DURATION_REGEX = /^(\d+)([hdmw])$/;
var Duration;
(function (Duration) {
    Duration[Duration["MINUTE"] = 60] = "MINUTE";
    Duration[Duration["HOUR"] = 3600] = "HOUR";
    Duration[Duration["DAY"] = 86400] = "DAY";
    Duration[Duration["WEEK"] = 604800] = "WEEK";
})(Duration = exports.Duration || (exports.Duration = {}));
const DURATIONS = {
    m: Duration.MINUTE,
    h: Duration.HOUR,
    d: Duration.DAY,
    w: Duration.WEEK,
};
function calculateRetention(flag) {
    const match = exports.DURATION_REGEX.exec(flag);
    if (!match) {
        throw new error_1.FirebaseError(`"retention" flag must be a duration string (e.g. 24h, 2w, or 7d)`);
    }
    const d = parseInt(match[1], 10) * DURATIONS[match[2]];
    if (isNaN(d)) {
        throw new error_1.FirebaseError(`Failed to parse provided retention time "${flag}"`);
    }
    return d;
}
exports.calculateRetention = calculateRetention;