UNPKG

@palmares/databases

Version:

Add support for working with databases with palmares framework

84 lines (82 loc) 3.02 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/migrations/actions/operation.ts var operation_exports = {}; __export(operation_exports, { Operation: () => Operation }); module.exports = __toCommonJS(operation_exports); 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 ""; } }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { Operation });