@hashgraph/hedera-local
Version:
Developer tooling for running Local Hedera Network (Consensus + Mirror Nodes).
120 lines • 4.29 kB
JavaScript
;
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.StateData = void 0;
const AccountCreationState_1 = require("../state/AccountCreationState");
const CleanUpState_1 = require("../state/CleanUpState");
const AttachState_1 = require("../state/AttachState");
const InitState_1 = require("../state/InitState");
const NetworkPrepState_1 = require("../state/NetworkPrepState");
const StartState_1 = require("../state/StartState");
const StopState_1 = require("../state/StopState");
const ResourceCreationState_1 = require("../state/ResourceCreationState");
/**
* Class representing the state data.
*/
class StateData {
/**
* Get the selected state configuration based on the state name.
* @param {string} stateName - The name of the state.
* @returns {StateConfiguration | undefined} The configuration for the selected state, or undefined if the state name is not recognized.
* @public
*/
getSelectedStateConfiguration(stateName) {
switch (stateName) {
case 'start':
return this.getStartConfiguration();
case 'restart':
return this.getRestartConfiguration();
case 'stop':
return this.getStopConfiguration();
case 'accountCreation':
return this.getAccountCreationConfiguration();
case 'resourceCreation':
return this.getResourceCreationConfiguration();
default:
return undefined;
}
}
/**
* Get the configuration for the restart state.
* @returns {StateConfiguration} The configuration for the restart state.
* @private
*/
getRestartConfiguration() {
return {
'stateMachineName': 'restart',
'states': [
new CleanUpState_1.CleanUpState(),
new StopState_1.StopState(),
new InitState_1.InitState(),
new StartState_1.StartState(),
new NetworkPrepState_1.NetworkPrepState(),
new AccountCreationState_1.AccountCreationState(),
new ResourceCreationState_1.ResourceCreationState(),
new CleanUpState_1.CleanUpState(),
new AttachState_1.AttachState()
]
};
}
/**
* Get the configuration for the start state.
* @returns {StateConfiguration} The configuration for the start state.
* @private
*/
getStartConfiguration() {
return {
'stateMachineName': 'start',
'states': [
new InitState_1.InitState(),
new StartState_1.StartState(),
new NetworkPrepState_1.NetworkPrepState(),
new AccountCreationState_1.AccountCreationState(),
new ResourceCreationState_1.ResourceCreationState(),
new CleanUpState_1.CleanUpState(),
new AttachState_1.AttachState()
]
};
}
/**
* Get the configuration for the stop state.
* @returns {StateConfiguration} The configuration for the stop state.
* @private
*/
getStopConfiguration() {
return {
'stateMachineName': 'stop',
'states': [
new StopState_1.StopState()
]
};
}
/**
* Get the configuration for the resource creation state.
* @returns {StateConfiguration} The configuration for the resource creation state.
* @private
*/
getResourceCreationConfiguration() {
return {
'stateMachineName': 'resourceCreation',
'states': [
new ResourceCreationState_1.ResourceCreationState()
]
};
}
/**
* Get the configuration for the account creation state.
* @returns {StateConfiguration} The configuration for the account creation state.
* @private
*/
getAccountCreationConfiguration() {
return {
'stateMachineName': 'accountCreation',
'states': [
new AccountCreationState_1.AccountCreationState()
]
};
}
}
exports.StateData = StateData;
//# sourceMappingURL=StateData.js.map