var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });

// src/migrations/actions/operation.ts
var Operation = class {
  static {
    __name(this, "Operation");
  }
  /**
  * Function that will be used to construct and build the state of all of the models in the application so we
  * can compare to the original ones.
  *
  * @param state - A state instance that holds all of the models of the application before.
  * @param domainName - The name of the domain where this model was defined.
  * @param domainPath - The path of the domain where this model exists so we can add the migration file there.
  */
  async stateForwards(_state, _domainName, _domainPath) {
  }
  /**
  * Method that runs when a migration is running on a migration file, when this happens we will call the exact
  * function of the engine migrations.
  *
  * We also have the fromState (which will be state when the state) which will be the state of the models
  * before running the migration and `toState` will be state AFTER running the migration
  */
  async run(_migration, _engineInstance, _fromState, _toState, _returnOfInit) {
  }
  // eslint-disable-next-line ts/require-await
  static async defaultToGenerate(domainName, domainPath, modelName, data) {
    return {
      operation: this,
      domainName,
      domainPath,
      modelName,
      order: 0,
      dependsOn: [],
      data
    };
  }
  // eslint-disable-next-line ts/require-await
  static async toString(_engine, indentation = 0, data) {
    return {
      asString: ""
    };
  }
  // eslint-disable-next-line ts/require-await
  static async defaultToString(indentation = 0, customAttributesOfAction = "") {
    const ident = "  ".repeat(indentation);
    return `${ident}new actions.${this.name}(${customAttributesOfAction !== "" ? `
${customAttributesOfAction}
${ident}` : ""})`;
  }
  // eslint-disable-next-line ts/require-await
  static async describe(data) {
    return "";
  }
};

// src/migrations/actions/misc.ts
var RunJs = class extends Operation {
  static {
    __name(this, "RunJs");
  }
  code;
  constructor(code) {
    super();
    this.code = code;
  }
  async run(migration, engineInstance, _, toState, returnOfInit) {
    const stateModels = {};
    const modelNamesAlreadyAvailable = Object.keys(toState);
    for (const modelName of modelNamesAlreadyAvailable) {
      stateModels[modelName] = toState[modelName].class;
    }
    await Promise.resolve(this.code(migration, engineInstance, stateModels, returnOfInit));
  }
};
export {
  RunJs
};
