@axium/server 0.34.1 → 0.34.2
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/README.md +8 -0
- package/dist/main.js +40 -27
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/main.js
CHANGED
|
@@ -82,17 +82,30 @@ async function rlConfirm(question = 'Is this ok') {
|
|
|
82
82
|
io.exit('Aborted.');
|
|
83
83
|
}
|
|
84
84
|
async function dbInitTables() {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
85
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
86
|
+
try {
|
|
87
|
+
const info = db.getUpgradeInfo();
|
|
88
|
+
const schema = db.getFullSchema({ exclude: Object.keys(info.current) });
|
|
89
|
+
const delta = db.computeDelta({ tables: {}, indexes: [] }, schema);
|
|
90
|
+
if (db.deltaIsEmpty(delta))
|
|
91
|
+
return;
|
|
92
|
+
for (const text of db.displayDelta(delta))
|
|
93
|
+
console.log(text);
|
|
94
|
+
await rlConfirm();
|
|
95
|
+
const _ = __addDisposableResource(env_2, db.connect(), true);
|
|
96
|
+
await db.applyDelta(delta);
|
|
97
|
+
Object.assign(info.current, schema.versions);
|
|
98
|
+
db.setUpgradeInfo(info);
|
|
99
|
+
}
|
|
100
|
+
catch (e_2) {
|
|
101
|
+
env_2.error = e_2;
|
|
102
|
+
env_2.hasError = true;
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
const result_1 = __disposeResources(env_2);
|
|
106
|
+
if (result_1)
|
|
107
|
+
await result_1;
|
|
108
|
+
}
|
|
96
109
|
}
|
|
97
110
|
function configReplacer(opt) {
|
|
98
111
|
return (key, value) => {
|
|
@@ -265,7 +278,7 @@ try {
|
|
|
265
278
|
.description('Check the structure of the database')
|
|
266
279
|
.option('-s, --strict', 'Throw errors instead of emitting warnings for most column problems')
|
|
267
280
|
.action(async (opt) => {
|
|
268
|
-
const
|
|
281
|
+
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
269
282
|
try {
|
|
270
283
|
await io.run('Checking for sudo', 'which sudo').catch(io.exit);
|
|
271
284
|
await io.run('Checking for psql', 'which psql').catch(io.exit);
|
|
@@ -277,7 +290,7 @@ try {
|
|
|
277
290
|
await db._sql(`SELECT 1 FROM pg_database WHERE datname = 'axium'`, 'Checking for database').then(throwUnlessRows).catch(io.exit);
|
|
278
291
|
await db._sql(`SELECT 1 FROM pg_roles WHERE rolname = 'axium'`, 'Checking for user').then(throwUnlessRows).catch(io.exit);
|
|
279
292
|
io.start('Connecting to database');
|
|
280
|
-
const _ = __addDisposableResource(
|
|
293
|
+
const _ = __addDisposableResource(env_3, db.connect(), true);
|
|
281
294
|
io.done();
|
|
282
295
|
io.start('Getting schema metadata');
|
|
283
296
|
const schemas = await db.database.introspection.getSchemas().catch(io.exit);
|
|
@@ -316,14 +329,14 @@ try {
|
|
|
316
329
|
else
|
|
317
330
|
io.warn(unchecked);
|
|
318
331
|
}
|
|
319
|
-
catch (
|
|
320
|
-
|
|
321
|
-
|
|
332
|
+
catch (e_3) {
|
|
333
|
+
env_3.error = e_3;
|
|
334
|
+
env_3.hasError = true;
|
|
322
335
|
}
|
|
323
336
|
finally {
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
326
|
-
await
|
|
337
|
+
const result_2 = __disposeResources(env_3);
|
|
338
|
+
if (result_2)
|
|
339
|
+
await result_2;
|
|
327
340
|
}
|
|
328
341
|
});
|
|
329
342
|
axiumDB
|
|
@@ -572,21 +585,21 @@ try {
|
|
|
572
585
|
.addOption(opts.check)
|
|
573
586
|
.argument('<plugin>', 'the plugin to initialize')
|
|
574
587
|
.action(async (search) => {
|
|
575
|
-
const
|
|
588
|
+
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
576
589
|
try {
|
|
577
590
|
const plugin = _findPlugin(search);
|
|
578
591
|
if (!plugin)
|
|
579
592
|
io.exit(`Can't find a plugin matching "${search}"`);
|
|
580
|
-
const _ = __addDisposableResource(
|
|
593
|
+
const _ = __addDisposableResource(env_4, db.connect(), true);
|
|
581
594
|
}
|
|
582
|
-
catch (
|
|
583
|
-
|
|
584
|
-
|
|
595
|
+
catch (e_4) {
|
|
596
|
+
env_4.error = e_4;
|
|
597
|
+
env_4.hasError = true;
|
|
585
598
|
}
|
|
586
599
|
finally {
|
|
587
|
-
const
|
|
588
|
-
if (
|
|
589
|
-
await
|
|
600
|
+
const result_3 = __disposeResources(env_4);
|
|
601
|
+
if (result_3)
|
|
602
|
+
await result_3;
|
|
590
603
|
}
|
|
591
604
|
});
|
|
592
605
|
axiumApps = program.command('apps').description('Manage Axium apps').addOption(opts.global);
|