lakutata 2.0.78 → 2.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/lib/core/Application.cjs +24 -20
- package/src/lib/core/Application.mjs +62 -58
- package/vendor/Package.17.cjs +184 -195
- package/vendor/Package.17.mjs +176 -187
package/package.json
CHANGED
|
@@ -58,7 +58,7 @@ const _ = require("../base/EventEmitter.cjs");
|
|
|
58
58
|
|
|
59
59
|
const w = require("../base/internal/DatabaseSymbol.cjs");
|
|
60
60
|
|
|
61
|
-
const
|
|
61
|
+
const A = require("../../decorators/di/Inject.cjs");
|
|
62
62
|
|
|
63
63
|
require("../base/async-constructor/AsyncConstructor.cjs");
|
|
64
64
|
|
|
@@ -294,15 +294,15 @@ require("assert");
|
|
|
294
294
|
|
|
295
295
|
require("string_decoder");
|
|
296
296
|
|
|
297
|
-
const
|
|
297
|
+
const O = e => e && e.__esModule ? e : {
|
|
298
298
|
default: e
|
|
299
299
|
};
|
|
300
300
|
|
|
301
|
-
const S =
|
|
301
|
+
const S = O(n);
|
|
302
302
|
|
|
303
|
-
const C =
|
|
303
|
+
const C = O(u);
|
|
304
304
|
|
|
305
|
-
const D =
|
|
305
|
+
const D = O(x);
|
|
306
306
|
|
|
307
307
|
var I = {};
|
|
308
308
|
|
|
@@ -322,29 +322,29 @@ const k = P.__importDefault(S.default);
|
|
|
322
322
|
|
|
323
323
|
const R = o.error;
|
|
324
324
|
|
|
325
|
-
const
|
|
325
|
+
const L = o.InstanceChecker;
|
|
326
326
|
|
|
327
|
-
const
|
|
327
|
+
const B = o.requireImportUtils();
|
|
328
328
|
|
|
329
329
|
class CommandUtils {
|
|
330
330
|
static async loadDataSource(e) {
|
|
331
331
|
let t;
|
|
332
332
|
try {
|
|
333
|
-
[t] = await (0,
|
|
333
|
+
[t] = await (0, B.importOrRequireFile)(e);
|
|
334
334
|
} catch (t) {
|
|
335
335
|
throw new Error(`Unable to open file: "${e}". ${t.message}`);
|
|
336
336
|
}
|
|
337
337
|
if (!t || typeof t !== "object") {
|
|
338
338
|
throw new Error(`Given data source file must contain export of a DataSource instance`);
|
|
339
339
|
}
|
|
340
|
-
if (
|
|
340
|
+
if (L.InstanceChecker.isDataSource(t)) {
|
|
341
341
|
return t;
|
|
342
342
|
}
|
|
343
343
|
const r = [];
|
|
344
344
|
for (const e in t) {
|
|
345
345
|
const i = t[e];
|
|
346
346
|
const n = await i;
|
|
347
|
-
if (
|
|
347
|
+
if (L.InstanceChecker.isDataSource(n)) {
|
|
348
348
|
r.push(n);
|
|
349
349
|
}
|
|
350
350
|
}
|
|
@@ -390,11 +390,11 @@ class CommandUtils {
|
|
|
390
390
|
|
|
391
391
|
M = I.CommandUtils = CommandUtils;
|
|
392
392
|
|
|
393
|
-
var
|
|
393
|
+
var N = o.requireAnsis();
|
|
394
394
|
|
|
395
|
-
const G = s.getDefaultExportFromCjs(
|
|
395
|
+
const G = s.getDefaultExportFromCjs(N);
|
|
396
396
|
|
|
397
|
-
const {Ansis: F, ansi256: $, fg: U, bgAnsi256: Q, bg: J, rgb: V, bgRgb: H, hex: z, bgHex: W, reset: K, inverse: X, hidden: Y, visible: Z, bold: ee, dim: te, italic: re, underline: ie, strikethrough: ne, strike: ae, black: oe, red: se, green: ce, yellow: ue, blue: pe, magenta: le, cyan: de, white: he, grey: ge, gray: me, blackBright: qe, redBright: ye, greenBright: je, yellowBright: fe, blueBright: be, magentaBright: xe, cyanBright: ve, whiteBright: Ee, bgBlack: _e, bgRed: we, bgGreen:
|
|
397
|
+
const {Ansis: F, ansi256: $, fg: U, bgAnsi256: Q, bg: J, rgb: V, bgRgb: H, hex: z, bgHex: W, reset: K, inverse: X, hidden: Y, visible: Z, bold: ee, dim: te, italic: re, underline: ie, strikethrough: ne, strike: ae, black: oe, red: se, green: ce, yellow: ue, blue: pe, magenta: le, cyan: de, white: he, grey: ge, gray: me, blackBright: qe, redBright: ye, greenBright: je, yellowBright: fe, blueBright: be, magentaBright: xe, cyanBright: ve, whiteBright: Ee, bgBlack: _e, bgRed: we, bgGreen: Ae, bgYellow: Oe, bgBlue: Se, bgMagenta: Ce, bgCyan: De, bgWhite: Ie, bgGrey: Me, bgGray: Pe, bgBlackBright: Te, bgRedBright: ke, bgGreenBright: Re, bgYellowBright: Le, bgBlueBright: Be, bgMagentaBright: Ne, bgCyanBright: Ge, bgWhiteBright: Fe} = G;
|
|
398
398
|
|
|
399
399
|
var $e;
|
|
400
400
|
|
|
@@ -537,6 +537,10 @@ exports.Application = class Application extends l.Module {
|
|
|
537
537
|
switch (e.toUpperCase()) {
|
|
538
538
|
case "MIGRATION_GENERATE":
|
|
539
539
|
{
|
|
540
|
+
this.eventEmitter.removeAllListeners(exports.ApplicationState.Launched);
|
|
541
|
+
this.eventEmitter.removeAllListeners(exports.ApplicationState.Done);
|
|
542
|
+
this.eventEmitter.removeAllListeners(exports.ApplicationState.UncaughtException);
|
|
543
|
+
this.eventEmitter.removeAllListeners(exports.ApplicationState.FatalException);
|
|
540
544
|
const r = process.env[e];
|
|
541
545
|
const i = e => {
|
|
542
546
|
const t = [];
|
|
@@ -667,27 +671,27 @@ exports.GenerateMigration = Ue = class GenerateMigration extends t.Provider {
|
|
|
667
671
|
if (this.check) {
|
|
668
672
|
console.log(G.green`No changes in database schema were found`);
|
|
669
673
|
if (this.exitProcess) {
|
|
670
|
-
this.app.exit(0);
|
|
674
|
+
return this.app.exit(0);
|
|
671
675
|
} else {
|
|
672
676
|
return;
|
|
673
677
|
}
|
|
674
678
|
} else {
|
|
675
679
|
console.log(G.yellow`No changes in database schema were found`);
|
|
676
680
|
if (this.exitProcess) {
|
|
677
|
-
this.app.exit(1);
|
|
681
|
+
return this.app.exit(1);
|
|
678
682
|
} else {
|
|
679
683
|
return;
|
|
680
684
|
}
|
|
681
685
|
}
|
|
682
686
|
} else if (!this.path) {
|
|
683
687
|
console.log(G.yellow`Please specify a migration path`);
|
|
684
|
-
this.app.exit(1);
|
|
688
|
+
return this.app.exit(1);
|
|
685
689
|
}
|
|
686
690
|
const r = this.outputJs ? Ue.getJavascriptTemplate(S.default.basename(this.path), this.timestamp, e, t.reverse(), this.esm) : Ue.getTemplate(S.default.basename(this.path), this.timestamp, e, t.reverse());
|
|
687
691
|
if (this.check) {
|
|
688
692
|
console.log(G.yellow`Unexpected changes in database schema were found in check mode:\n\n${G.white(r)}`);
|
|
689
693
|
if (this.exitProcess) {
|
|
690
|
-
this.app.exit(0);
|
|
694
|
+
return this.app.exit(0);
|
|
691
695
|
} else {
|
|
692
696
|
return;
|
|
693
697
|
}
|
|
@@ -699,14 +703,14 @@ exports.GenerateMigration = Ue = class GenerateMigration extends t.Provider {
|
|
|
699
703
|
await M.createFile(e, r);
|
|
700
704
|
console.log(G.green`Migration ${G.blue(e)} has been generated successfully.`);
|
|
701
705
|
if (this.exitProcess) {
|
|
702
|
-
this.app.exit(0);
|
|
706
|
+
return this.app.exit(0);
|
|
703
707
|
} else {
|
|
704
708
|
return;
|
|
705
709
|
}
|
|
706
710
|
}
|
|
707
711
|
} catch (e) {
|
|
708
712
|
o.PlatformTools.PlatformTools.logCmdErr("Error during migration generation:", e);
|
|
709
|
-
this.app.exit(1);
|
|
713
|
+
return this.app.exit(1);
|
|
710
714
|
}
|
|
711
715
|
}
|
|
712
716
|
static queryParams(e) {
|
|
@@ -732,7 +736,7 @@ exports.GenerateMigration = Ue = class GenerateMigration extends t.Provider {
|
|
|
732
736
|
}
|
|
733
737
|
};
|
|
734
738
|
|
|
735
|
-
e.__decorate([
|
|
739
|
+
e.__decorate([ A.Inject(exports.Application), e.__metadata("design:type", exports.Application) ], exports.GenerateMigration.prototype, "app", void 0);
|
|
736
740
|
|
|
737
741
|
e.__decorate([ r.Configurable(i.DTO.String().required()), e.__metadata("design:type", String) ], exports.GenerateMigration.prototype, "path", void 0);
|
|
738
742
|
|
|
@@ -2,9 +2,9 @@ import { _ as t, a as e } from "../../../vendor/Package.1.mjs";
|
|
|
2
2
|
|
|
3
3
|
import { Provider as o } from "./Provider.mjs";
|
|
4
4
|
|
|
5
|
-
import { Configurable as
|
|
5
|
+
import { Configurable as r } from "../../decorators/di/Configurable.mjs";
|
|
6
6
|
|
|
7
|
-
import { D as
|
|
7
|
+
import { D as i } from "../../../vendor/Package.2.mjs";
|
|
8
8
|
|
|
9
9
|
import n from "path";
|
|
10
10
|
|
|
@@ -38,9 +38,9 @@ import { Entrypoint as S } from "../../components/entrypoint/Entrypoint.mjs";
|
|
|
38
38
|
|
|
39
39
|
import { L as k } from "../../../vendor/Package.14.mjs";
|
|
40
40
|
|
|
41
|
-
import { Accept as
|
|
41
|
+
import { Accept as A } from "../../decorators/dto/Accept.mjs";
|
|
42
42
|
|
|
43
|
-
import { mkdirSync as
|
|
43
|
+
import { mkdirSync as I } from "fs";
|
|
44
44
|
|
|
45
45
|
import D from "node:path";
|
|
46
46
|
|
|
@@ -52,7 +52,7 @@ import { EventEmitter as B } from "../base/EventEmitter.mjs";
|
|
|
52
52
|
|
|
53
53
|
import { DatabaseSymbol as M } from "../base/internal/DatabaseSymbol.mjs";
|
|
54
54
|
|
|
55
|
-
import { Inject as
|
|
55
|
+
import { Inject as L } from "../../decorators/di/Inject.mjs";
|
|
56
56
|
|
|
57
57
|
import "../base/async-constructor/AsyncConstructor.mjs";
|
|
58
58
|
|
|
@@ -288,15 +288,15 @@ import "assert";
|
|
|
288
288
|
|
|
289
289
|
import "string_decoder";
|
|
290
290
|
|
|
291
|
-
var
|
|
291
|
+
var T = {};
|
|
292
292
|
|
|
293
293
|
"use strict";
|
|
294
294
|
|
|
295
|
-
Object.defineProperty(
|
|
295
|
+
Object.defineProperty(T, "__esModule", {
|
|
296
296
|
value: true
|
|
297
297
|
});
|
|
298
298
|
|
|
299
|
-
var q =
|
|
299
|
+
var q = T.CommandUtils = void 0;
|
|
300
300
|
|
|
301
301
|
const F = g;
|
|
302
302
|
|
|
@@ -326,10 +326,10 @@ class CommandUtils {
|
|
|
326
326
|
}
|
|
327
327
|
const o = [];
|
|
328
328
|
for (const t in e) {
|
|
329
|
-
const
|
|
330
|
-
const
|
|
331
|
-
if (Q.InstanceChecker.isDataSource(
|
|
332
|
-
o.push(
|
|
329
|
+
const r = e[t];
|
|
330
|
+
const i = await r;
|
|
331
|
+
if (Q.InstanceChecker.isDataSource(i)) {
|
|
332
|
+
o.push(i);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
if (o.length === 0) {
|
|
@@ -372,13 +372,13 @@ class CommandUtils {
|
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
-
q =
|
|
375
|
+
q = T.CommandUtils = CommandUtils;
|
|
376
376
|
|
|
377
377
|
var J = m();
|
|
378
378
|
|
|
379
379
|
const V = d(J);
|
|
380
380
|
|
|
381
|
-
const {Ansis: H, ansi256: z, fg: W, bgAnsi256: K, bg: X, rgb: Y, bgRgb: Z, hex: tt, bgHex: et, reset: ot, inverse:
|
|
381
|
+
const {Ansis: H, ansi256: z, fg: W, bgAnsi256: K, bg: X, rgb: Y, bgRgb: Z, hex: tt, bgHex: et, reset: ot, inverse: rt, hidden: it, visible: nt, bold: st, dim: at, italic: ct, underline: pt, strikethrough: mt, strike: lt, black: ut, red: ht, green: dt, yellow: gt, blue: jt, magenta: ft, cyan: yt, white: bt, grey: vt, gray: xt, blackBright: Et, redBright: wt, greenBright: Ot, yellowBright: Pt, blueBright: Ct, magentaBright: St, cyanBright: kt, whiteBright: At, bgBlack: It, bgRed: Dt, bgGreen: Rt, bgYellow: Nt, bgBlue: Bt, bgMagenta: Mt, bgCyan: Lt, bgWhite: Tt, bgGrey: qt, bgGray: Ft, bgBlackBright: $t, bgRedBright: Ut, bgGreenBright: Gt, bgYellowBright: Qt, bgBlueBright: _t, bgMagentaBright: Jt, bgCyanBright: Vt, bgWhiteBright: Ht} = V;
|
|
382
382
|
|
|
383
383
|
var zt;
|
|
384
384
|
|
|
@@ -451,9 +451,9 @@ let Kt = class Application extends b {
|
|
|
451
451
|
static onFatalException(t) {
|
|
452
452
|
this.eventEmitter.once(Wt.FatalException, (async e => {
|
|
453
453
|
const o = await this.getLogger();
|
|
454
|
-
let
|
|
455
|
-
if (typeof
|
|
456
|
-
return process.exit(
|
|
454
|
+
let r = await t(e, o);
|
|
455
|
+
if (typeof r !== "number") r = 1;
|
|
456
|
+
return process.exit(r);
|
|
457
457
|
}));
|
|
458
458
|
return this.launch();
|
|
459
459
|
}
|
|
@@ -505,12 +505,12 @@ let Kt = class Application extends b {
|
|
|
505
505
|
t.set("@runtime", process.cwd());
|
|
506
506
|
this.aliasDeclarations.forEach((e => {
|
|
507
507
|
const o = e.alias;
|
|
508
|
-
const
|
|
508
|
+
const r = e.createIfNotExist;
|
|
509
509
|
Object.keys(o).forEach((e => {
|
|
510
510
|
t.set(e, o[e]);
|
|
511
|
-
if (
|
|
511
|
+
if (r) {
|
|
512
512
|
const t = D.resolve(e);
|
|
513
|
-
if (!R(t))
|
|
513
|
+
if (!R(t)) I(D.resolve(e), {
|
|
514
514
|
recursive: true
|
|
515
515
|
});
|
|
516
516
|
}
|
|
@@ -521,30 +521,34 @@ let Kt = class Application extends b {
|
|
|
521
521
|
switch (t.toUpperCase()) {
|
|
522
522
|
case "MIGRATION_GENERATE":
|
|
523
523
|
{
|
|
524
|
+
this.eventEmitter.removeAllListeners(Wt.Launched);
|
|
525
|
+
this.eventEmitter.removeAllListeners(Wt.Done);
|
|
526
|
+
this.eventEmitter.removeAllListeners(Wt.UncaughtException);
|
|
527
|
+
this.eventEmitter.removeAllListeners(Wt.FatalException);
|
|
524
528
|
const o = process.env[t];
|
|
525
|
-
const
|
|
529
|
+
const r = t => {
|
|
526
530
|
const e = [];
|
|
527
531
|
for (const o in t) {
|
|
528
532
|
if (t[o] && t[o].class && t[o].class.databaseSymbol && t[o].class.databaseSymbol === M) {
|
|
529
|
-
const
|
|
530
|
-
if (!
|
|
531
|
-
Reflect.set(
|
|
532
|
-
e.push(
|
|
533
|
+
const r = t[o].options;
|
|
534
|
+
if (!r) continue;
|
|
535
|
+
Reflect.set(r, "dataSourceName", o);
|
|
536
|
+
e.push(r);
|
|
533
537
|
}
|
|
534
538
|
}
|
|
535
539
|
return e;
|
|
536
540
|
};
|
|
537
|
-
const
|
|
538
|
-
if (!
|
|
541
|
+
const i = [ ...e.components ? r(e.components) : [], ...e.providers ? r(e.providers) : [] ];
|
|
542
|
+
if (!i.length) process.exit(0);
|
|
539
543
|
e.bootstrap = [];
|
|
540
|
-
|
|
541
|
-
const n = `GenerateMigration${
|
|
544
|
+
i.forEach(((t, r) => {
|
|
545
|
+
const n = `GenerateMigration${r}${Date.now()}`;
|
|
542
546
|
if (!e.providers) e.providers = {};
|
|
543
547
|
e.providers[n] = {
|
|
544
548
|
class: Yt,
|
|
545
549
|
path: o,
|
|
546
550
|
outputJs: false,
|
|
547
|
-
exitProcess:
|
|
551
|
+
exitProcess: r === i.length - 1,
|
|
548
552
|
dataSourceName: Reflect.get(t, "dataSourceName"),
|
|
549
553
|
dataSource: t
|
|
550
554
|
};
|
|
@@ -555,7 +559,7 @@ let Kt = class Application extends b {
|
|
|
555
559
|
}
|
|
556
560
|
}
|
|
557
561
|
const o = new E;
|
|
558
|
-
return new Promise(((t,
|
|
562
|
+
return new Promise(((t, r) => {
|
|
559
563
|
O.validateAsync(e).then((e => {
|
|
560
564
|
e.bootstrap?.push((async t => {
|
|
561
565
|
const e = function() {
|
|
@@ -567,8 +571,8 @@ let Kt = class Application extends b {
|
|
|
567
571
|
}));
|
|
568
572
|
o.set(zt, {
|
|
569
573
|
options: e
|
|
570
|
-
}).then((e => e.once(v, (() => t(e))).once(x, (t => this.processFatalException(t))))).catch(
|
|
571
|
-
})).catch(
|
|
574
|
+
}).then((e => e.once(v, (() => t(e))).once(x, (t => this.processFatalException(t))))).catch(r);
|
|
575
|
+
})).catch(r);
|
|
572
576
|
}));
|
|
573
577
|
}
|
|
574
578
|
get alias() {
|
|
@@ -595,9 +599,9 @@ let Kt = class Application extends b {
|
|
|
595
599
|
}
|
|
596
600
|
};
|
|
597
601
|
|
|
598
|
-
t([
|
|
602
|
+
t([ A(i.Object().pattern(i.String(), i.String()).required()), e("design:type", Function), e("design:paramtypes", [ Object ]), e("design:returntype", Object) ], Kt, "env", null);
|
|
599
603
|
|
|
600
|
-
t([
|
|
604
|
+
t([ A(i.Object().pattern(i.String(), i.String()).required(), i.Boolean().optional().default(false)), e("design:type", Function), e("design:paramtypes", [ Object, Boolean ]), e("design:returntype", Object) ], Kt, "alias", null);
|
|
601
605
|
|
|
602
606
|
Kt = zt = t([ f(true) ], Kt);
|
|
603
607
|
|
|
@@ -651,27 +655,27 @@ let Yt = Xt = class GenerateMigration extends o {
|
|
|
651
655
|
if (this.check) {
|
|
652
656
|
console.log(V.green`No changes in database schema were found`);
|
|
653
657
|
if (this.exitProcess) {
|
|
654
|
-
this.app.exit(0);
|
|
658
|
+
return this.app.exit(0);
|
|
655
659
|
} else {
|
|
656
660
|
return;
|
|
657
661
|
}
|
|
658
662
|
} else {
|
|
659
663
|
console.log(V.yellow`No changes in database schema were found`);
|
|
660
664
|
if (this.exitProcess) {
|
|
661
|
-
this.app.exit(1);
|
|
665
|
+
return this.app.exit(1);
|
|
662
666
|
} else {
|
|
663
667
|
return;
|
|
664
668
|
}
|
|
665
669
|
}
|
|
666
670
|
} else if (!this.path) {
|
|
667
671
|
console.log(V.yellow`Please specify a migration path`);
|
|
668
|
-
this.app.exit(1);
|
|
672
|
+
return this.app.exit(1);
|
|
669
673
|
}
|
|
670
674
|
const o = this.outputJs ? Xt.getJavascriptTemplate(n.basename(this.path), this.timestamp, t, e.reverse(), this.esm) : Xt.getTemplate(n.basename(this.path), this.timestamp, t, e.reverse());
|
|
671
675
|
if (this.check) {
|
|
672
676
|
console.log(V.yellow`Unexpected changes in database schema were found in check mode:\n\n${V.white(o)}`);
|
|
673
677
|
if (this.exitProcess) {
|
|
674
|
-
this.app.exit(0);
|
|
678
|
+
return this.app.exit(0);
|
|
675
679
|
} else {
|
|
676
680
|
return;
|
|
677
681
|
}
|
|
@@ -683,14 +687,14 @@ let Yt = Xt = class GenerateMigration extends o {
|
|
|
683
687
|
await q.createFile(t, o);
|
|
684
688
|
console.log(V.green`Migration ${V.blue(t)} has been generated successfully.`);
|
|
685
689
|
if (this.exitProcess) {
|
|
686
|
-
this.app.exit(0);
|
|
690
|
+
return this.app.exit(0);
|
|
687
691
|
} else {
|
|
688
692
|
return;
|
|
689
693
|
}
|
|
690
694
|
}
|
|
691
695
|
} catch (t) {
|
|
692
696
|
l.PlatformTools.logCmdErr("Error during migration generation:", t);
|
|
693
|
-
this.app.exit(1);
|
|
697
|
+
return this.app.exit(1);
|
|
694
698
|
}
|
|
695
699
|
}
|
|
696
700
|
static queryParams(t) {
|
|
@@ -699,14 +703,14 @@ let Yt = Xt = class GenerateMigration extends o {
|
|
|
699
703
|
}
|
|
700
704
|
return `, ${JSON.stringify(t)}`;
|
|
701
705
|
}
|
|
702
|
-
static getTemplate(t, e, o,
|
|
703
|
-
const
|
|
704
|
-
return `import { MigrationInterface, QueryRunner } from "lakutata/orm";\n\nexport class ${
|
|
706
|
+
static getTemplate(t, e, o, r) {
|
|
707
|
+
const i = `${u(t, true)}${e}`;
|
|
708
|
+
return `import { MigrationInterface, QueryRunner } from "lakutata/orm";\n\nexport class ${i} implements MigrationInterface {\n name = '${i}'\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`;
|
|
705
709
|
}
|
|
706
|
-
static getJavascriptTemplate(t, e, o,
|
|
710
|
+
static getJavascriptTemplate(t, e, o, r, i) {
|
|
707
711
|
const n = `${u(t, true)}${e}`;
|
|
708
|
-
const s =
|
|
709
|
-
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 ${n} {\n name = '${n}'\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${
|
|
712
|
+
const s = i ? "export" : "module.exports =";
|
|
713
|
+
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 ${n} {\n name = '${n}'\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`;
|
|
710
714
|
}
|
|
711
715
|
static prettifyQuery(t) {
|
|
712
716
|
const e = h.format(t, {
|
|
@@ -716,27 +720,27 @@ let Yt = Xt = class GenerateMigration extends o {
|
|
|
716
720
|
}
|
|
717
721
|
};
|
|
718
722
|
|
|
719
|
-
t([
|
|
723
|
+
t([ L(Kt), e("design:type", Kt) ], Yt.prototype, "app", void 0);
|
|
720
724
|
|
|
721
|
-
t([ i
|
|
725
|
+
t([ r(i.String().required()), e("design:type", String) ], Yt.prototype, "path", void 0);
|
|
722
726
|
|
|
723
|
-
t([ i
|
|
727
|
+
t([ r(i.String().allow("").optional().default("")), e("design:type", String) ], Yt.prototype, "dataSourceName", void 0);
|
|
724
728
|
|
|
725
|
-
t([
|
|
729
|
+
t([ r(), e("design:type", Object) ], Yt.prototype, "dataSource", void 0);
|
|
726
730
|
|
|
727
|
-
t([ i
|
|
731
|
+
t([ r(i.Boolean().optional().default(true)), e("design:type", Boolean) ], Yt.prototype, "pretty", void 0);
|
|
728
732
|
|
|
729
|
-
t([ i
|
|
733
|
+
t([ r(i.Boolean().optional().default(false)), e("design:type", Boolean) ], Yt.prototype, "outputJs", void 0);
|
|
730
734
|
|
|
731
|
-
t([ i
|
|
735
|
+
t([ r(i.Boolean().optional().default(false)), e("design:type", Boolean) ], Yt.prototype, "esm", void 0);
|
|
732
736
|
|
|
733
|
-
t([ i
|
|
737
|
+
t([ r(i.Boolean().optional().default(false)), e("design:type", Boolean) ], Yt.prototype, "dryRun", void 0);
|
|
734
738
|
|
|
735
|
-
t([ i
|
|
739
|
+
t([ r(i.Boolean().optional().default(false)), e("design:type", Boolean) ], Yt.prototype, "check", void 0);
|
|
736
740
|
|
|
737
|
-
t([ i
|
|
741
|
+
t([ r(i.Number().optional().default((() => Date.now()))), e("design:type", Number) ], Yt.prototype, "timestamp", void 0);
|
|
738
742
|
|
|
739
|
-
t([ i
|
|
743
|
+
t([ r(i.Boolean().optional().default(true)), e("design:type", Boolean) ], Yt.prototype, "exitProcess", void 0);
|
|
740
744
|
|
|
741
745
|
Yt = Xt = t([ y() ], Yt);
|
|
742
746
|
|