lakutata
Version:
An IoC-based universal application framework.
846 lines (668 loc) • 28.2 kB
JavaScript
/* Build Date: Mon Jan 05 2026 23:52:23 GMT+0800 (China Standard Time) */
import { _ as e, a as t } from "../../../vendor/Package.internal.3.mjs";
import { Provider as o } from "./Provider.mjs";
import { Configurable as r } from "../../decorators/di/Configurable.mjs";
import { D as n } from "../../../vendor/Package.internal.7.mjs";
import i from "path";
import { D as s } from "../../../vendor/Package.internal.512.mjs";
import { b as a, I as p, e as c, c as m, d as l, s as u } from "../../../vendor/Package.internal.51.mjs";
import { r as h } from "../../../vendor/Package.internal.310.mjs";
import d from "fs/promises";
import { a as g } from "../../../vendor/Package.internal.2.mjs";
import { Transient as f } from "../../decorators/di/Lifetime.mjs";
import { Module as y, MODULE_INITIALIZED as j, MODULE_INITIALIZE_ERROR as b } from "./Module.mjs";
import { C as x } from "../../../vendor/Package.internal.4.mjs";
import { ApplicationConfigLoader as v } from "../base/internal/ApplicationConfigLoader.mjs";
import { ApplicationOptions as E } from "../../options/ApplicationOptions.mjs";
import { Alias as w } from "./Alias.mjs";
import { G as O } from "../../../vendor/Package.internal.5.mjs";
import { Entrypoint as C } from "../../components/entrypoint/Entrypoint.mjs";
import { L as A } from "../../../vendor/Package.internal.54.mjs";
import { Accept as P } from "../../decorators/dto/Accept.mjs";
import { mkdirSync as S } from "fs";
import R from "node:path";
import { existsSync as I } from "node:fs";
import { As as k } from "../helpers/As.mjs";
import { EventEmitter as M } from "../base/EventEmitter.mjs";
import { DatabaseSymbol as D } from "../base/internal/DatabaseSymbol.mjs";
import "../base/async-constructor/AsyncConstructor.mjs";
import "../base/async-constructor/Append.mjs";
import "../helpers/IsPromiseLike.mjs";
import "../helpers/IsPromise.mjs";
import "util/types";
import "../../exceptions/MethodNotFoundException.mjs";
import "../base/abstracts/Exception.mjs";
import "../helpers/Templating.mjs";
import "../base/internal/CamelCase.mjs";
import "../helpers/NoCase.mjs";
import "../helpers/DevNull.mjs";
import "../../../vendor/Package.internal.6.mjs";
import "../base/internal/ThrowWarning.mjs";
import "../ioc/DependencyInjectionContainer.mjs";
import "util";
import "../ioc/Errors.mjs";
import "../../exceptions/di/DependencyInjectionException.mjs";
import "../base/internal/ConstructorSymbol.mjs";
import "../../constants/DIMetadataKey.mjs";
import "../../../vendor/Package.internal.1.mjs";
import "node:crypto";
import "../base/internal/DataValidator.mjs";
import "node:util/types";
import "../validation/VLD.mjs";
import "url";
import "../../exceptions/dto/InvalidValueException.mjs";
import "../../../vendor/Package.internal.8.mjs";
import "../helpers/IsHtml.mjs";
import "../helpers/IsXML.mjs";
import "../../constants/DTOMetadataKey.mjs";
import "../helpers/ObjectConstructor.mjs";
import "../helpers/ObjectParentConstructors.mjs";
import "../helpers/ObjectParentConstructor.mjs";
import "../helpers/ObjectPrototype.mjs";
import "../ioc/InjectionMode.mjs";
import "../ioc/Lifetime.mjs";
import "../ioc/ListModules.mjs";
import "os";
import "stream";
import "events";
import "../ioc/Utils.mjs";
import "../ioc/FunctionTokenizer.mjs";
import "../ioc/LoadModules.mjs";
import "../ioc/Resolvers.mjs";
import "../ioc/ParamParser.mjs";
import "../base/internal/ObjectLifetime.mjs";
import "../../exceptions/di/LifetimeLockedException.mjs";
import "../base/internal/ObjectWeakRefs.mjs";
import "../base/internal/ConfigurableRecordsInjection.mjs";
import "../base/internal/ObjectConfiguration.mjs";
import "../base/internal/ObjectInjection.mjs";
import "../base/internal/ObjectContainer.mjs";
import "../../decorators/dto/Expect.mjs";
import "../../decorators/dto/IndexSignature.mjs";
import "../base/internal/MethodValidation.mjs";
import "../../exceptions/dto/InvalidMethodAcceptException.mjs";
import "../../exceptions/dto/InvalidMethodReturnException.mjs";
import "../helpers/IsEmptyObject.mjs";
import "../../../vendor/Package.internal.52.mjs";
import "buffer";
import "tty";
import "crypto";
import "module";
import "node:url";
import "node:fs/promises";
import "node:events";
import "node:stream";
import "node:string_decoder";
import "./Component.mjs";
import "../../options/ModuleOptions.mjs";
import "../../options/ModuleLoadObjectsOptions.mjs";
import "../../options/LoadNamedObjectOptions.mjs";
import "../../options/LoadAnonymousObjectOptions.mjs";
import "../../options/OverridableNamedObjectOptions.mjs";
import "../../options/OverridableObjectOptions.mjs";
import "../base/internal/ModuleConfigLoader.mjs";
import "../../exceptions/di/OverridableObjectTargetConfigNotFoundException.mjs";
import "../../exceptions/InvalidObjectTypeException.mjs";
import "../helpers/ArrayToSet.mjs";
import "../helpers/SetToArray.mjs";
import "../helpers/NonceStr.mjs";
import "../helpers/RandomString.mjs";
import "../../exceptions/alias/InvalidAliasNameException.mjs";
import "../../exceptions/alias/AliasExistsException.mjs";
import "../../exceptions/alias/AliasNotFoundException.mjs";
import "../base/internal/ControllerEntrypoint.mjs";
import "../helpers/ObjectHash.mjs";
import "../helpers/GetObjectNestingDepth.mjs";
import "../../exceptions/InvalidActionPatternDepthException.mjs";
import "../base/internal/StringifyPattern.mjs";
import "../../../vendor/Package.internal.522.mjs";
import "../../../vendor/Package.internal.55.mjs";
import "../base/internal/PatternManager.mjs";
import "../../components/entrypoint/lib/Controller.mjs";
import "../context/CLIContext.mjs";
import "../base/Context.mjs";
import "../context/HTTPContext.mjs";
import "node:http";
import "../context/ServiceContext.mjs";
import "../../components/entrypoint/exceptions/ControllerActionNotFoundException.mjs";
import "../../exceptions/DestroyRuntimeContainerException.mjs";
import "../helpers/GetObjectPropertyPaths.mjs";
import "../helpers/UniqueArray.mjs";
import "../../components/entrypoint/exceptions/DuplicateActionNameException.mjs";
import "../../components/entrypoint/lib/AccessControl.mjs";
import "../../components/entrypoint/exceptions/AccessDenyException.mjs";
import "../../components/entrypoint/lib/AccessControlRule.mjs";
import "../../components/entrypoint/exceptions/InvalidActionGroupException.mjs";
import "node:os";
import "node:diagnostics_channel";
import "assert";
import "worker_threads";
import "string_decoder";
import "node:worker_threads";
var N = {};
Object.defineProperty(N, "__esModule", {
value: true
});
var T = N.CommandUtils = void 0;
const L = h;
const B = L.__importDefault(d);
const $ = L.__importDefault(i);
const q = c;
const F = p;
const U = a();
class CommandUtils {
static async loadDataSource(e) {
let t;
try {
[t] = await (0, U.importOrRequireFile)(e);
} catch (t) {
throw new Error(`Unable to open file: "${e}". ${t.message}`);
}
if (!t || typeof t !== "object") {
throw new Error(`Given data source file must contain export of a DataSource instance`);
}
if (F.InstanceChecker.isDataSource(t)) {
return t;
}
const o = [];
for (const e in t) {
const r = t[e];
const n = await r;
if (F.InstanceChecker.isDataSource(n)) {
o.push(n);
}
}
if (o.length === 0) {
throw new Error(`Given data source file must contain export of a DataSource instance`);
}
if (o.length > 1) {
throw new Error(`Given data source file must contain only one export of DataSource instance`);
}
return o[0];
}
static async createDirectories(e) {
await B.default.mkdir(e, {
recursive: true
});
}
static async createFile(e, t, o = true) {
await CommandUtils.createDirectories($.default.dirname(e));
if (o === false && await CommandUtils.fileExists(e)) {
return;
}
await B.default.writeFile(e, t);
}
static async readFile(e) {
const t = await B.default.readFile(e);
return t.toString();
}
static async fileExists(e) {
try {
await B.default.access(e, B.default.constants.F_OK);
return true;
} catch {
return false;
}
}
static getTimestamp(e) {
if (e && (isNaN(e) || e < 0)) {
throw new q.TypeORMError(`timestamp option should be a non-negative number. received: ${e}`);
}
return e ? new Date(Number(e)).getTime() : Date.now();
}
}
T = N.CommandUtils = CommandUtils;
var _ = {
exports: {}
};
_.exports;
let G, Q, H, {defineProperty: J, setPrototypeOf: V, create: z, keys: W} = Object, X = "", {round: K, max: Y} = Math, Z = e => {
let t = /([a-f\d]{3,6})/i.exec(e)?.[1], o = t?.length, r = parseInt(6 ^ o ? 3 ^ o ? "0" : t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, 16);
return [ r >> 16 & 255, r >> 8 & 255, 255 & r ];
}, ee = (e, t, o) => e ^ t || t ^ o ? 16 + 36 * K(e / 51) + 6 * K(t / 51) + K(o / 51) : 8 > e ? 16 : e > 248 ? 231 : K(24 * (e - 8) / 247) + 232, te = e => {
let t, o, r, n, i;
return 8 > e ? 30 + e : 16 > e ? e - 8 + 90 : (232 > e ? (i = (e -= 16) % 36, t = (e / 36 | 0) / 5,
o = (i / 6 | 0) / 5, r = i % 6 / 5) : t = o = r = (10 * (e - 232) + 8) / 255, n = 2 * Y(t, o, r),
n ? 30 + (K(r) << 2 | K(o) << 1 | K(t)) + (2 ^ n ? 0 : 60) : 30);
}, oe = (() => {
let e = e => r.some(t => e.test(t)), t = globalThis, o = t.process ?? {}, r = o.argv ?? [], n = o.env ?? {}, i = -1;
try {
G = "," + W(n).join(",");
} catch (e) {
n = {}, i = 0;
}
let s = "FORCE_COLOR", a = {
false: 0,
0: 0,
1: 1,
2: 2,
3: 3
}[n[s]] ?? -1, p = s in n && a || e(/^--color=?(true|always)?$/);
return p && (i = a), ~i || (i = ((e, t, o) => (Q = e.TERM, {
"24bit": 3,
truecolor: 3,
ansi256: 2,
ansi: 1
}[e.COLORTERM] || (e.CI ? /,GITHUB/.test(G) ? 3 : 1 : t && "dumb" !== Q ? o ? 3 : /-256/.test(Q) ? 2 : 1 : 0)))(n, !!n.PM2_HOME || n.NEXT_RUNTIME?.includes("edge") || !!o.stdout?.isTTY, "win32" === o.platform)),
!a || n.NO_COLOR || e(/^--(no-color|color=(false|never))$/) ? 0 : t.window?.chrome || p && !i ? 3 : i;
})(), re = {
open: X,
close: X
}, ne = 39, ie = 49, se = {}, ae = ({p: e}, {open: t, close: o}) => {
let r = (e, ...n) => {
if (!e) {
if (t && t === o) return t;
if ((e ?? X) === X) return X;
}
let i, s = e.raw ? String.raw({
raw: e
}, ...n) : X + e, a = r.p, p = a.o, c = a.c;
if (s.includes("")) for (;a; a = a.p) {
let {open: e, close: t} = a, o = t.length, r = X, n = 0;
if (o) for (;~(i = s.indexOf(t, n)); n = i + o) r += s.slice(n, i) + e;
s = r + s.slice(n);
}
return p + (s.includes("\n") ? s.replace(/(\r?\n)/g, c + "$1" + p) : s) + c;
}, n = t, i = o;
return e && (n = e.o + t, i = o + e.c), V(r, H), r.p = {
open: t,
close: o,
o: n,
c: i,
p: e
}, r.open = n, r.close = i, r;
};
const pe = new function e(t = oe) {
let o = {
Ansis: e,
level: t,
isSupported: () => n,
strip: e => e.replace(/[][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, X),
extend(e) {
for (let t in e) {
let o = e[t], n = (typeof o)[0];
"s" === n ? (r(t, m(...Z(o))), r(f(t), l(...Z(o)))) : r(t, o, "f" === n);
}
return H = z({}, se), V(o, H), o;
}
}, r = (e, t, o) => {
se[e] = {
get() {
let r = o ? (...e) => ae(this, t(...e)) : ae(this, t);
return J(this, e, {
value: r
}), r;
}
};
}, n = t > 0, i = (e, t) => n ? {
open: `[${e}m`,
close: `[${t}m`
} : re, s = e => t => e(...Z(t)), a = (e, t) => (o, r, n) => i(`${e}8;2;${o};${r};${n}`, t), p = (e, t) => (o, r, n) => i(((e, t, o) => te(ee(e, t, o)))(o, r, n) + e, t), c = e => (t, o, r) => e(ee(t, o, r)), m = a(3, ne), l = a(4, ie), u = e => i("38;5;" + e, ne), h = e => i("48;5;" + e, ie);
2 === t ? (m = c(u), l = c(h)) : 1 === t && (m = p(0, ne), l = p(10, ie), u = e => i(te(e), ne),
h = e => i(te(e) + 10, ie));
let d, g = {
fg: u,
bg: h,
rgb: m,
bgRgb: l,
hex: s(m),
bgHex: s(l),
visible: re,
reset: i(0, 0),
bold: i(1, 22),
dim: i(2, 22),
italic: i(3, 23),
underline: i(4, 24),
inverse: i(7, 27),
hidden: i(8, 28),
strikethrough: i(9, 29)
}, f = e => "bg" + e[0].toUpperCase() + e.slice(1), y = "Bright";
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map((e, t) => {
d = f(e), 8 > t ? (g[e + y] = i(90 + t, ne), g[d + y] = i(100 + t, ie)) : t = 60,
g[e] = i(30 + t, ne), g[d] = i(40 + t, ie);
}), o.extend(g);
};
_.exports = pe, pe.default = pe;
var ce = _.exports;
const me = g(ce);
const {Ansis: le, fg: ue, bg: he, rgb: de, bgRgb: ge, hex: fe, bgHex: ye, reset: je, inverse: be, hidden: xe, visible: ve, bold: Ee, dim: we, italic: Oe, underline: Ce, strikethrough: Ae, black: Pe, red: Se, green: Re, yellow: Ie, blue: ke, magenta: Me, cyan: De, white: Ne, gray: Te, redBright: Le, greenBright: Be, yellowBright: $e, blueBright: qe, magentaBright: Fe, cyanBright: Ue, whiteBright: _e, bgBlack: Ge, bgRed: Qe, bgGreen: He, bgYellow: Je, bgBlue: Ve, bgMagenta: ze, bgCyan: We, bgWhite: Xe, bgGray: Ke, bgRedBright: Ye, bgGreenBright: Ze, bgYellowBright: et, bgBlueBright: tt, bgMagentaBright: ot, bgCyanBright: rt, bgWhiteBright: nt} = me;
var it;
(function(e) {
e["Launched"] = "LAUNCHED";
e["Done"] = "DONE";
e["UncaughtException"] = "UNCAUGHT_EXCEPTION";
e["FatalException"] = "FATAL_EXCEPTION";
})(it || (it = {}));
class Application extends y {
constructor() {
super(...arguments);
this.ConfigLoader = v;
this.options = {
components: {
log: {
class: A
},
entrypoint: {
class: C
}
},
bootstrap: [ "log" ]
};
}
static {
this.eventEmitter = new M;
}
static {
this.environmentVariableMap = new Map;
}
static {
this.aliasDeclarations = [];
}
static async getLogger() {
return this.appInstance ? await this.appInstance.getObject("log") : await (new x).set(A);
}
static env(e) {
Object.keys(e).forEach(t => this.environmentVariableMap.set(t, e[t]));
return this.launch();
}
static alias(e, t = false) {
this.aliasDeclarations.push({
alias: e ? e : {},
createIfNotExist: t
});
return this.launch();
}
static onLaunched(e) {
this.eventEmitter.once(it.Launched, async t => e(t, await t.getObject("log")));
return this.launch();
}
static onDone(e) {
this.eventEmitter.once(it.Done, async t => e(t, await t.getObject("log")));
return this.launch();
}
static onUncaughtException(e) {
this.eventEmitter.on(it.UncaughtException, async t => {
const o = await this.getLogger();
await e(t, o);
});
return this.launch();
}
static onFatalException(e) {
this.eventEmitter.once(it.FatalException, async t => {
const o = await this.getLogger();
let r = await e(t, o);
if (typeof r !== "number") r = 1;
return process.exit(r);
});
return this.launch();
}
static run(e) {
Reflect.set(this, "launchOptions", e);
return this.launch();
}
static launch() {
if (this.launchTimeout) clearTimeout(this.launchTimeout);
this.launchTimeout = setTimeout(async () => {
process.on("uncaughtException", async e => {
if (this.eventEmitter.listenerCount(it.UncaughtException)) return this.eventEmitter.emit(it.UncaughtException, e);
const t = await this.getLogger();
return t.warn(new Error("UncaughtException", {
cause: e
}));
});
try {
Reflect.set(this, "appInstance", await this.launchApplication());
} catch (e) {
this.processFatalException(e);
}
});
return this;
}
static processFatalException(e) {
if (!this.eventEmitter.listenerCount(it.FatalException)) {
return process.nextTick(async () => {
const t = await this.getLogger();
t.error(new Error("FatalException", {
cause: e
}));
});
}
this.eventEmitter.emit(it.FatalException, e);
}
static async launchApplication() {
this.eventEmitter.once("exit", async (e, t) => {
try {
await this.eventEmitter.emitRequest(it.Done, e);
await o.destroy();
process.exit(t ? t : 0);
} catch (e) {
process.exit(1);
}
});
this.environmentVariableMap.forEach((e, t) => process.env[t] = e);
const e = w.getAliasInstance();
e.set("@runtime", process.cwd());
this.aliasDeclarations.forEach(t => {
const o = t.alias;
const r = t.createIfNotExist;
Object.keys(o).forEach(t => {
e.set(t, o[t]);
if (r) {
const e = R.resolve(t);
if (!I(e)) S(R.resolve(t), {
recursive: true
});
}
});
});
const t = typeof this.launchOptions === "object" ? this.launchOptions : await this.launchOptions();
for (const e in process.env) {
switch (e.toUpperCase()) {
case "MIGRATION_GENERATE":
{
this.eventEmitter.removeAllListeners(it.Launched);
this.eventEmitter.removeAllListeners(it.Done);
this.eventEmitter.removeAllListeners(it.UncaughtException);
this.eventEmitter.removeAllListeners(it.FatalException);
const o = process.env[e];
const r = e => {
const t = [];
for (const o in e) {
if (e[o] && e[o].class && e[o].class.databaseSymbol && e[o].class.databaseSymbol === D) {
const r = e[o].options;
if (!r) continue;
Reflect.set(r, "dataSourceName", o);
t.push(r);
}
}
return t;
};
const n = [ ...t.components ? r(t.components) : [], ...t.providers ? r(t.providers) : [] ];
if (!n.length) process.exit(0);
t.bootstrap = [];
n.forEach((e, r) => {
const i = `GenerateMigration${r}${Date.now()}`;
if (!t.providers) t.providers = {};
t.providers[i] = {
class: at,
path: o,
outputJs: false,
exitProcess: r === n.length - 1,
dataSourceName: Reflect.get(e, "dataSourceName"),
dataSource: e
};
t.bootstrap.push(i);
});
}
break;
}
}
const o = new x;
return new Promise((e, r) => {
E.validateAsync(t).then(t => {
t.bootstrap?.push(async e => {
const t = function() {
this.options.bootstrap?.pop();
k(Reflect.getOwnMetadata("#bootstrap", this))?.pop();
};
t.bind(k(e))();
this.eventEmitter.emit(it.Launched, k(e));
});
o.set(Application, {
options: t
}).then(t => t.once(j, () => e(t)).once(b, e => this.processFatalException(e))).catch(r);
}).catch(r);
});
}
get alias() {
return w.getAliasInstance();
}
get appId() {
return O().appId;
}
get appName() {
return O().appName;
}
get timezone() {
return O().timezone;
}
get uptime() {
return Math.floor(process.uptime());
}
exit(e) {
if (typeof e === "boolean" && e) {
return process.exit(2);
} else {
Application.eventEmitter.emit("exit", this, e ? e : 0);
}
}
}
e([ P(n.Object().pattern(n.String(), n.String()).required()), t("design:type", Function), t("design:paramtypes", [ Object ]), t("design:returntype", Object) ], Application, "env", null);
e([ P(n.Object().pattern(n.String(), n.String()).required(), n.Boolean().optional().default(false)), t("design:type", Function), t("design:paramtypes", [ Object, Boolean ]), t("design:returntype", Object) ], Application, "alias", null);
var st;
let at = st = class GenerateMigration extends o {
get extension() {
return this.outputJs ? ".js" : ".ts";
}
get filename() {
return this.timestamp + "-" + (this.dataSourceName ? this.dataSourceName : i.basename(this.path)) + this.extension;
}
#e;
#t;
async init() {
this.#e = await this.getObject(Application);
this.#t = new s.DataSource(this.dataSource);
this.#t.setOptions({
synchronize: false,
migrationsRun: false,
dropSchema: false,
logging: false
});
this.#t = await this.#t.initialize();
await this.handle();
}
async destroy() {
await (this.#t?.destroy());
}
async handle() {
try {
const e = [], t = [];
try {
const o = await this.#t.driver.createSchemaBuilder().log();
if (this.pretty) {
o.upQueries.forEach(e => {
e.query = st.prettifyQuery(e.query);
});
o.downQueries.forEach(e => {
e.query = st.prettifyQuery(e.query);
});
}
o.upQueries.forEach(t => {
e.push(" await queryRunner.query(`" + t.query.replaceAll("`", "\\`") + "`" + st.queryParams(t.parameters) + ");");
});
o.downQueries.forEach(e => {
t.push(" await queryRunner.query(`" + e.query.replaceAll("`", "\\`") + "`" + st.queryParams(e.parameters) + ");");
});
} finally {
await this.#t.destroy();
}
if (!e.length) {
if (this.check) {
console.log(me.green`No changes in database schema were found`);
if (this.exitProcess) {
return this.#e.exit(0);
} else {
return;
}
} else {
console.log(me.yellow`No changes in database schema were found`);
if (this.exitProcess) {
return this.#e.exit(1);
} else {
return;
}
}
} else if (!this.path) {
console.log(me.yellow`Please specify a migration path`);
return this.#e.exit(1);
}
const o = this.outputJs ? st.getJavascriptTemplate(i.basename(this.path), this.timestamp, e, t.reverse(), this.esm) : st.getTemplate(i.basename(this.path), this.timestamp, e, t.reverse());
if (this.check) {
console.log(me.yellow`Unexpected changes in database schema were found in check mode:\n\n${me.white(o)}`);
if (this.exitProcess) {
return this.#e.exit(0);
} else {
return;
}
}
if (this.dryRun) {
console.log(me.green(`Migration ${me.blue(this.path + this.extension)} has content:\n\n${me.white(o)}`));
} else {
const e = i.isAbsolute(this.path) ? i.join(this.path, this.filename) : i.join(process.cwd(), this.path, this.filename);
await T.createFile(e, o);
console.log(me.green`Migration ${me.blue(e)} has been generated successfully.`);
if (this.exitProcess) {
return this.#e.exit(0);
} else {
return;
}
}
} catch (e) {
m.PlatformTools.logCmdErr("Error during migration generation:", e);
return this.#e.exit(1);
}
}
static queryParams(e) {
if (!e || !e.length) {
return "";
}
return `, ${JSON.stringify(e)}`;
}
static getTemplate(e, t, o, r) {
const n = `${l(e, true)}${t}`;
return `import { MigrationInterface, QueryRunner } from "lakutata/orm";\n\nexport class ${n} implements MigrationInterface {\n name = '${n}'\n\n public async up(queryRunner: QueryRunner): Promise<void> {\n${o.join(`\n`)}\n }\n\n public async down(queryRunner: QueryRunner): Promise<void> {\n${r.join(`\n`)}\n }\n\n}\n`;
}
static getJavascriptTemplate(e, t, o, r, n) {
const i = `${l(e, true)}${t}`;
const s = n ? "export" : "module.exports =";
return `/**\n * @typedef {import('lakutata/orm').MigrationInterface} MigrationInterface\n * @typedef {import('lakutata/orm').QueryRunner} QueryRunner\n */\n\n/**\n * @class\n * @implements {MigrationInterface}\n */\n${s} class ${i} {\n name = '${i}'\n\n /**\n * @param {QueryRunner} queryRunner\n */\n async up(queryRunner) {\n${o.join(`\n`)}\n }\n\n /**\n * @param {QueryRunner} queryRunner\n */\n async down(queryRunner) {\n${r.join(`\n`)}\n }\n}\n`;
}
static prettifyQuery(e) {
const t = u.format(e, {
indent: " "
});
return "\n" + t.replace(/^/gm, " ") + "\n ";
}
};
e([ r(n.String().required()), t("design:type", String) ], at.prototype, "path", void 0);
e([ r(n.String().allow("").optional().default("")), t("design:type", String) ], at.prototype, "dataSourceName", void 0);
e([ r(), t("design:type", Object) ], at.prototype, "dataSource", void 0);
e([ r(n.Boolean().optional().default(true)), t("design:type", Boolean) ], at.prototype, "pretty", void 0);
e([ r(n.Boolean().optional().default(false)), t("design:type", Boolean) ], at.prototype, "outputJs", void 0);
e([ r(n.Boolean().optional().default(false)), t("design:type", Boolean) ], at.prototype, "esm", void 0);
e([ r(n.Boolean().optional().default(false)), t("design:type", Boolean) ], at.prototype, "dryRun", void 0);
e([ r(n.Boolean().optional().default(false)), t("design:type", Boolean) ], at.prototype, "check", void 0);
e([ r(n.Number().optional().default(() => Date.now())), t("design:type", Number) ], at.prototype, "timestamp", void 0);
e([ r(n.Boolean().optional().default(true)), t("design:type", Boolean) ], at.prototype, "exitProcess", void 0);
at = st = e([ f() ], at);
export { Application, it as ApplicationState, at as G };