@axium/server 0.34.1 → 0.34.3
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/linking.js +2 -2
- package/dist/main.js +40 -30
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/linking.js
CHANGED
|
@@ -12,14 +12,14 @@ function info(id) {
|
|
|
12
12
|
return [text, link];
|
|
13
13
|
}
|
|
14
14
|
export function* listRouteLinks(options = {}) {
|
|
15
|
-
if (!options.only) {
|
|
15
|
+
if (!options.only || !options.only.length) {
|
|
16
16
|
const [text, link] = info('#builtin');
|
|
17
17
|
yield { text, id: '#builtin', from: link, to: resolve(import.meta.dirname, '../routes') };
|
|
18
18
|
}
|
|
19
19
|
for (const plugin of plugins.values()) {
|
|
20
20
|
if (!plugin.server?.routes)
|
|
21
21
|
continue;
|
|
22
|
-
if (options.only && !options.only.includes(plugin.name))
|
|
22
|
+
if (options.only && options.only.length && !options.only.includes(plugin.name))
|
|
23
23
|
continue;
|
|
24
24
|
const [text, link] = info(plugin.name);
|
|
25
25
|
const to = resolve(join(plugin.dirname, plugin.server.routes));
|
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) => {
|
|
@@ -173,7 +186,6 @@ try {
|
|
|
173
186
|
io.warn('Invalid timeout value, using default.');
|
|
174
187
|
io.setCommandTimeout(timeout);
|
|
175
188
|
}),
|
|
176
|
-
packagesDir: new Option('-p, --packages-dir <dir>', 'the directory to look for packages in'),
|
|
177
189
|
};
|
|
178
190
|
axiumDB = program.command('db').alias('database').description('Manage the database').addOption(opts.timeout);
|
|
179
191
|
axiumDB
|
|
@@ -265,7 +277,7 @@ try {
|
|
|
265
277
|
.description('Check the structure of the database')
|
|
266
278
|
.option('-s, --strict', 'Throw errors instead of emitting warnings for most column problems')
|
|
267
279
|
.action(async (opt) => {
|
|
268
|
-
const
|
|
280
|
+
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
269
281
|
try {
|
|
270
282
|
await io.run('Checking for sudo', 'which sudo').catch(io.exit);
|
|
271
283
|
await io.run('Checking for psql', 'which psql').catch(io.exit);
|
|
@@ -277,7 +289,7 @@ try {
|
|
|
277
289
|
await db._sql(`SELECT 1 FROM pg_database WHERE datname = 'axium'`, 'Checking for database').then(throwUnlessRows).catch(io.exit);
|
|
278
290
|
await db._sql(`SELECT 1 FROM pg_roles WHERE rolname = 'axium'`, 'Checking for user').then(throwUnlessRows).catch(io.exit);
|
|
279
291
|
io.start('Connecting to database');
|
|
280
|
-
const _ = __addDisposableResource(
|
|
292
|
+
const _ = __addDisposableResource(env_3, db.connect(), true);
|
|
281
293
|
io.done();
|
|
282
294
|
io.start('Getting schema metadata');
|
|
283
295
|
const schemas = await db.database.introspection.getSchemas().catch(io.exit);
|
|
@@ -316,14 +328,14 @@ try {
|
|
|
316
328
|
else
|
|
317
329
|
io.warn(unchecked);
|
|
318
330
|
}
|
|
319
|
-
catch (
|
|
320
|
-
|
|
321
|
-
|
|
331
|
+
catch (e_3) {
|
|
332
|
+
env_3.error = e_3;
|
|
333
|
+
env_3.hasError = true;
|
|
322
334
|
}
|
|
323
335
|
finally {
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
326
|
-
await
|
|
336
|
+
const result_2 = __disposeResources(env_3);
|
|
337
|
+
if (result_2)
|
|
338
|
+
await result_2;
|
|
327
339
|
}
|
|
328
340
|
});
|
|
329
341
|
axiumDB
|
|
@@ -572,21 +584,21 @@ try {
|
|
|
572
584
|
.addOption(opts.check)
|
|
573
585
|
.argument('<plugin>', 'the plugin to initialize')
|
|
574
586
|
.action(async (search) => {
|
|
575
|
-
const
|
|
587
|
+
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
576
588
|
try {
|
|
577
589
|
const plugin = _findPlugin(search);
|
|
578
590
|
if (!plugin)
|
|
579
591
|
io.exit(`Can't find a plugin matching "${search}"`);
|
|
580
|
-
const _ = __addDisposableResource(
|
|
592
|
+
const _ = __addDisposableResource(env_4, db.connect(), true);
|
|
581
593
|
}
|
|
582
|
-
catch (
|
|
583
|
-
|
|
584
|
-
|
|
594
|
+
catch (e_4) {
|
|
595
|
+
env_4.error = e_4;
|
|
596
|
+
env_4.hasError = true;
|
|
585
597
|
}
|
|
586
598
|
finally {
|
|
587
|
-
const
|
|
588
|
-
if (
|
|
589
|
-
await
|
|
599
|
+
const result_3 = __disposeResources(env_4);
|
|
600
|
+
if (result_3)
|
|
601
|
+
await result_3;
|
|
590
602
|
}
|
|
591
603
|
});
|
|
592
604
|
axiumApps = program.command('apps').description('Manage Axium apps').addOption(opts.global);
|
|
@@ -742,7 +754,6 @@ try {
|
|
|
742
754
|
.description('Install Axium server')
|
|
743
755
|
.addOption(opts.force)
|
|
744
756
|
.addOption(opts.check)
|
|
745
|
-
.addOption(opts.packagesDir)
|
|
746
757
|
.option('-s, --skip', 'Skip already initialized steps', false)
|
|
747
758
|
.action(async (opt) => {
|
|
748
759
|
await db.init(opt).catch(io.exit);
|
|
@@ -776,7 +787,6 @@ try {
|
|
|
776
787
|
program
|
|
777
788
|
.command('link')
|
|
778
789
|
.description('Link routes provided by plugins and the server')
|
|
779
|
-
.addOption(opts.packagesDir)
|
|
780
790
|
.addOption(new Option('-l, --list', 'list route links').conflicts('delete'))
|
|
781
791
|
.option('-d, --delete', 'delete route links')
|
|
782
792
|
.argument('[name...]', 'List of plugin names to operate on. If not specified, operates on all plugins and built-in routes.')
|