Server IP : 85.214.239.14 / Your IP : 3.129.216.248 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /lib/node_modules/npm/node_modules/@tufjs/models/dist/ |
Upload File : |
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Timestamp = void 0; const base_1 = require("./base"); const file_1 = require("./file"); const utils_1 = require("./utils"); /** * A container for the signed part of timestamp metadata. * * A top-level that specifies the latest version of the snapshot role metadata file, * and hence the latest versions of all metadata and targets on the repository. */ class Timestamp extends base_1.Signed { constructor(options) { super(options); this.type = base_1.MetadataKind.Timestamp; this.snapshotMeta = options.snapshotMeta || new file_1.MetaFile({ version: 1 }); } equals(other) { if (!(other instanceof Timestamp)) { return false; } return super.equals(other) && this.snapshotMeta.equals(other.snapshotMeta); } toJSON() { return { _type: this.type, spec_version: this.specVersion, version: this.version, expires: this.expires, meta: { 'snapshot.json': this.snapshotMeta.toJSON() }, ...this.unrecognizedFields, }; } static fromJSON(data) { const { unrecognizedFields, ...commonFields } = base_1.Signed.commonFieldsFromJSON(data); const { meta, ...rest } = unrecognizedFields; return new Timestamp({ ...commonFields, snapshotMeta: snapshotMetaFromJSON(meta), unrecognizedFields: rest, }); } } exports.Timestamp = Timestamp; function snapshotMetaFromJSON(data) { let snapshotMeta; if (utils_1.guard.isDefined(data)) { const snapshotData = data['snapshot.json']; if (!utils_1.guard.isDefined(snapshotData) || !utils_1.guard.isObject(snapshotData)) { throw new TypeError('missing snapshot.json in meta'); } else { snapshotMeta = file_1.MetaFile.fromJSON(snapshotData); } } return snapshotMeta; }