UNPKG

@hashgraph/solo

Version:

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

40 lines 1.69 kB
// SPDX-License-Identifier: Apache-2.0 import { VersionRange } from '../../../../../business/utils/version-range.js'; import { IllegalArgumentError } from '../../../../../business/errors/illegal-argument-error.js'; import { SemanticVersion } from '../../../../../business/utils/semantic-version.js'; // The v7 migration adds postgres and redis components to RemoteConfig export class RemoteConfigV7Migration { get range() { return VersionRange.fromIntegerVersion(6); } get version() { return new SemanticVersion(7); } async migrate(source) { if (!source) { // We should never pass null or undefined to this method, if this happens we should throw an error throw new IllegalArgumentError('source must not be null or undefined'); } // eslint-disable-next-line @typescript-eslint/no-explicit-any const clone = structuredClone(source); const state = clone.state; // Initialise new component arrays (empty — no Postgres/Redis components existed before this schema version) if (!state.postgres) { state.postgres = []; } if (!state.redis) { state.redis = []; } // Initialise new component ID counters (start at 1, matching all other counters) if (!state.componentIds.postgres) { state.componentIds.postgres = 1; } if (!state.componentIds.redis) { state.componentIds.redis = 1; } // Set the schema version to the new version clone.schemaVersion = this.version.major; return clone; } } //# sourceMappingURL=remote-config-v7-migration.js.map