@axium/server 0.28.1 → 0.28.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/dist/database.d.ts +3 -1
- package/dist/database.js +3 -1
- package/dist/main.js +6 -2
- package/package.json +1 -1
- package/routes/admin/+layout.svelte +43 -6
- package/routes/admin/+page.svelte +1 -1
- package/routes/admin/plugins/+page.svelte +30 -33
package/dist/database.d.ts
CHANGED
|
@@ -487,7 +487,9 @@ export declare function getSchemaFiles(): Generator<[string, SchemaFile]>;
|
|
|
487
487
|
*/
|
|
488
488
|
export declare function getFullSchema(opt?: {
|
|
489
489
|
exclude?: string[];
|
|
490
|
-
}): SchemaDecl
|
|
490
|
+
}): SchemaDecl & {
|
|
491
|
+
versions: Record<string, number>;
|
|
492
|
+
};
|
|
491
493
|
export declare const UpgradesInfo: z.ZodObject<{
|
|
492
494
|
current: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodInt>>;
|
|
493
495
|
upgrades: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
package/dist/database.js
CHANGED
|
@@ -326,11 +326,13 @@ export function* getSchemaFiles() {
|
|
|
326
326
|
* Get the active schema
|
|
327
327
|
*/
|
|
328
328
|
export function getFullSchema(opt = {}) {
|
|
329
|
-
const fullSchema = { tables: {}, indexes: [] };
|
|
329
|
+
const fullSchema = { tables: {}, indexes: [], versions: {} };
|
|
330
330
|
for (const [pluginName, file] of getSchemaFiles()) {
|
|
331
331
|
if (opt.exclude?.includes(pluginName))
|
|
332
332
|
continue;
|
|
333
|
+
file.latest ??= file.versions.length - 1;
|
|
333
334
|
let currentSchema = { tables: {}, indexes: [] };
|
|
335
|
+
fullSchema.versions[pluginName] = file.latest;
|
|
334
336
|
for (const [version, schema] of file.versions.entries()) {
|
|
335
337
|
if (schema.delta)
|
|
336
338
|
applyDeltaToSchema(currentSchema, schema);
|
package/dist/main.js
CHANGED
|
@@ -55,7 +55,7 @@ import { apps } from '@axium/core';
|
|
|
55
55
|
import { AuditFilter, severityNames } from '@axium/core/audit';
|
|
56
56
|
import { formatDateRange } from '@axium/core/format';
|
|
57
57
|
import { io, outputDaemonStatus, pluginText } from '@axium/core/node';
|
|
58
|
-
import { _findPlugin, plugins } from '@axium/core/plugins';
|
|
58
|
+
import { _findPlugin, plugins, runIntegrations } from '@axium/core/plugins';
|
|
59
59
|
import { Argument, Option, program } from 'commander';
|
|
60
60
|
import { access } from 'node:fs/promises';
|
|
61
61
|
import { join, resolve } from 'node:path/posix';
|
|
@@ -80,7 +80,8 @@ async function rlConfirm(question = 'Is this ok') {
|
|
|
80
80
|
io.exit('Aborted.');
|
|
81
81
|
}
|
|
82
82
|
async function dbInitTables() {
|
|
83
|
-
const
|
|
83
|
+
const info = db.getUpgradeInfo();
|
|
84
|
+
const schema = db.getFullSchema({ exclude: Object.keys(info.current) });
|
|
84
85
|
const delta = db.computeDelta({ tables: {}, indexes: [] }, schema);
|
|
85
86
|
if (db.deltaIsEmpty(delta))
|
|
86
87
|
return;
|
|
@@ -88,6 +89,8 @@ async function dbInitTables() {
|
|
|
88
89
|
console.log(text);
|
|
89
90
|
await rlConfirm();
|
|
90
91
|
await db.applyDelta(delta);
|
|
92
|
+
Object.assign(info.current, schema.versions);
|
|
93
|
+
db.setUpgradeInfo(info);
|
|
91
94
|
}
|
|
92
95
|
function configReplacer(opt) {
|
|
93
96
|
return (key, value) => {
|
|
@@ -113,6 +116,7 @@ try {
|
|
|
113
116
|
await config.loadDefaults(safe);
|
|
114
117
|
if (configFromCLI)
|
|
115
118
|
await config.load(configFromCLI, { safe });
|
|
119
|
+
await runIntegrations();
|
|
116
120
|
program
|
|
117
121
|
.version($pkg.version)
|
|
118
122
|
.name('axium')
|
package/package.json
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<div id="admin-container">
|
|
9
|
-
<div
|
|
9
|
+
<div id="admin-sidebar">
|
|
10
10
|
{#each data.tabs as { href, name, icon: i, active }}
|
|
11
|
-
<a {href} class={['item', 'icon-text', active && 'active']}><Icon {i} /> {capitalize(name)}</a
|
|
11
|
+
<a {href} class={['item', 'icon-text', active && 'active']}><Icon {i} /> <span class="sidebar-text">{capitalize(name)}</span></a
|
|
12
|
+
>
|
|
12
13
|
{/each}
|
|
13
14
|
</div>
|
|
14
15
|
|
|
@@ -24,13 +25,16 @@
|
|
|
24
25
|
height: 100%;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
#admin-sidebar {
|
|
28
29
|
grid-column: 1;
|
|
29
30
|
width: 100%;
|
|
30
31
|
display: inline-flex;
|
|
31
32
|
flex-direction: column;
|
|
32
33
|
gap: 0.5em;
|
|
33
|
-
|
|
34
|
+
background-color: var(--bg-alt);
|
|
35
|
+
padding: 1em;
|
|
36
|
+
padding-left: 0;
|
|
37
|
+
border-radius: 0 1em 1em 0;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
.item {
|
|
@@ -39,12 +43,12 @@
|
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
.item:hover {
|
|
42
|
-
background-color: var(--bg-
|
|
46
|
+
background-color: var(--bg-strong);
|
|
43
47
|
cursor: pointer;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
.item.active {
|
|
47
|
-
background-color: var(--bg-
|
|
51
|
+
background-color: var(--bg-strong);
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
#admin-content {
|
|
@@ -53,4 +57,37 @@
|
|
|
53
57
|
overflow-x: hidden;
|
|
54
58
|
overflow-y: scroll;
|
|
55
59
|
}
|
|
60
|
+
|
|
61
|
+
@media (width < 700px) {
|
|
62
|
+
#admin-container {
|
|
63
|
+
grid-template-columns: 1fr;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#admin-content {
|
|
67
|
+
padding-bottom: 4em;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#admin-sidebar {
|
|
71
|
+
position: fixed;
|
|
72
|
+
grid-column: unset;
|
|
73
|
+
inset: auto 0 0;
|
|
74
|
+
border-radius: 1em;
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: row;
|
|
77
|
+
justify-content: space-around;
|
|
78
|
+
gap: 1em;
|
|
79
|
+
padding: 0.5em;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.sidebar-text {
|
|
83
|
+
display: none;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.item {
|
|
87
|
+
flex: 1 1 0;
|
|
88
|
+
border-radius: 1em;
|
|
89
|
+
padding: 1em;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
56
93
|
</style>
|
|
@@ -9,44 +9,41 @@
|
|
|
9
9
|
<h2>Plugins</h2>
|
|
10
10
|
|
|
11
11
|
{#each data.plugins as plugin}
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
{#
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
<div class="plugin">
|
|
13
|
+
<h3>{plugin.name}<span class="version">{plugin.version}</span></h3>
|
|
14
|
+
<p>
|
|
15
|
+
<strong>Loaded from</strong>
|
|
16
|
+
{#if plugin.path.endsWith('/package.json')}
|
|
17
|
+
<span class="path plugin-path">{plugin.path.slice(0, -13)}</span>
|
|
18
|
+
{:else}
|
|
19
|
+
<span class="path">{plugin.path}</span>
|
|
20
|
+
{/if}
|
|
21
|
+
{#if plugin._loadedBy}
|
|
22
|
+
by
|
|
23
|
+
<a class="path" href="/admin/config#{plugin._loadedBy}">{plugin._loadedBy}</a>
|
|
24
|
+
{/if}
|
|
25
|
+
</p>
|
|
26
|
+
<p><strong>Author:</strong> {plugin.author}</p>
|
|
27
|
+
<p class="apps">
|
|
28
|
+
<strong>Provided apps:</strong>
|
|
29
|
+
{#if plugin.apps?.length}
|
|
30
|
+
{#each plugin.apps as app, i}
|
|
31
|
+
<a href="/{app.id}">{app.name}</a>{i != plugin.apps.length - 1 ? ', ' : ''}
|
|
32
|
+
{/each}
|
|
33
|
+
{:else}<i>None</i>{/if}
|
|
34
|
+
</p>
|
|
35
|
+
<p>{plugin.description}</p>
|
|
36
|
+
</div>
|
|
35
37
|
{:else}
|
|
36
38
|
<i>No plugins loaded.</i>
|
|
37
39
|
{/each}
|
|
38
40
|
|
|
39
41
|
<style>
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
color:
|
|
44
|
-
margin-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.version::before {
|
|
48
|
-
content: 'v';
|
|
49
|
-
color: #888;
|
|
42
|
+
.plugin {
|
|
43
|
+
border-radius: 1em;
|
|
44
|
+
padding: 1em;
|
|
45
|
+
background-color: var(--bg-menu);
|
|
46
|
+
margin-bottom: 1em;
|
|
50
47
|
}
|
|
51
48
|
|
|
52
49
|
.path {
|