@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 CHANGED
@@ -1 +1,9 @@
1
1
  # Axium Server
2
+
3
+ Axium Server is the main server application and framework for Axium.
4
+
5
+ It includes:
6
+
7
+ - The `axium` (server) CLI
8
+ - The web UI/server and HTTP API
9
+ - Lots of database stuff
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 info = db.getUpgradeInfo();
86
- const schema = db.getFullSchema({ exclude: Object.keys(info.current) });
87
- const delta = db.computeDelta({ tables: {}, indexes: [] }, schema);
88
- if (db.deltaIsEmpty(delta))
89
- return;
90
- for (const text of db.displayDelta(delta))
91
- console.log(text);
92
- await rlConfirm();
93
- await db.applyDelta(delta);
94
- Object.assign(info.current, schema.versions);
95
- db.setUpgradeInfo(info);
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 env_2 = { stack: [], error: void 0, hasError: false };
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(env_2, db.connect(), true);
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 (e_2) {
320
- env_2.error = e_2;
321
- env_2.hasError = true;
331
+ catch (e_3) {
332
+ env_3.error = e_3;
333
+ env_3.hasError = true;
322
334
  }
323
335
  finally {
324
- const result_1 = __disposeResources(env_2);
325
- if (result_1)
326
- await result_1;
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 env_3 = { stack: [], error: void 0, hasError: false };
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(env_3, db.connect(), true);
592
+ const _ = __addDisposableResource(env_4, db.connect(), true);
581
593
  }
582
- catch (e_3) {
583
- env_3.error = e_3;
584
- env_3.hasError = true;
594
+ catch (e_4) {
595
+ env_4.error = e_4;
596
+ env_4.hasError = true;
585
597
  }
586
598
  finally {
587
- const result_2 = __disposeResources(env_3);
588
- if (result_2)
589
- await result_2;
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.')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/server",
3
- "version": "0.34.1",
3
+ "version": "0.34.3",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "funding": {
6
6
  "type": "individual",