UNPKG

@hashgraph/solo

Version:

An opinionated CLI tool to deploy and manage private Hedera Networks.

45 lines 1.32 kB
/** * SPDX-License-Identifier: Apache-2.0 */ import { SoloError } from '../../errors.js'; export class Migration { _migratedAt; _migratedBy; _fromVersion; constructor(migratedAt, migratedBy, fromVersion) { this._migratedAt = migratedAt; this._migratedBy = migratedBy; this._fromVersion = fromVersion; this.validate(); } /* -------- Getters -------- */ get migratedAt() { return this._migratedAt; } get migratedBy() { return this._migratedBy; } get fromVersion() { return this._fromVersion; } /* -------- Utilities -------- */ validate() { if (!(this.migratedAt instanceof Date)) { throw new SoloError(`Invalid migratedAt: ${this.migratedAt}`); } if (!this.migratedBy || typeof this.migratedBy !== 'string') { throw new SoloError(`Invalid migratedBy: ${this.migratedBy}`); } if (!this.fromVersion || typeof this.fromVersion !== 'string') { throw new SoloError(`Invalid fromVersion: ${this.fromVersion}`); } } toObject() { return { migratedAt: this.migratedAt, migratedBy: this.migratedBy, fromVersion: this.fromVersion, }; } } //# sourceMappingURL=migration.js.map