@axium/server 0.28.5 → 0.29.0
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/acl.d.ts +1 -1
- package/dist/api/admin.js +9 -3
- package/dist/api/metadata.js +2 -4
- package/dist/auth.js +1 -0
- package/dist/io.d.ts +2 -0
- package/dist/io.js +10 -0
- package/package.json +2 -2
- package/routes/admin/+page.svelte +6 -1
- package/routes/admin/plugins/+page.svelte +5 -3
package/dist/acl.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type Result<TB extends TableName> = AccessControlInternal & PermissionsFo
|
|
|
21
21
|
export type WithACL<TB extends TargetName> = kysely.Selectable<db.Schema[TB]> & {
|
|
22
22
|
userId: string;
|
|
23
23
|
acl: Result<`acl.${TB}`>[];
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
25
|
export interface ACLSelectionOptions {
|
|
26
26
|
/** If specified, files by user UUID */
|
|
27
27
|
user?: Pick<UserInternal, 'id' | 'roles' | 'tags'>;
|
package/dist/api/admin.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AuditFilter, Severity } from '@axium/core';
|
|
2
|
+
import { getVersionInfo } from '@axium/core/packages';
|
|
2
3
|
import { plugins } from '@axium/core/plugins';
|
|
3
4
|
import { jsonArrayFrom, jsonObjectFrom } from 'kysely/helpers/postgres';
|
|
4
5
|
import { omit } from 'utilium';
|
|
5
6
|
import * as z from 'zod';
|
|
6
|
-
import pkg from '../../package.json' with { type: 'json' };
|
|
7
7
|
import { audit, events, getEvents } from '../audit.js';
|
|
8
8
|
import { requireSession } from '../auth.js';
|
|
9
9
|
import { config } from '../config.js';
|
|
@@ -30,7 +30,11 @@ addRoute({
|
|
|
30
30
|
auditEvents,
|
|
31
31
|
configFiles: config.files.size,
|
|
32
32
|
plugins: plugins.size,
|
|
33
|
-
|
|
33
|
+
versions: {
|
|
34
|
+
server: await getVersionInfo('@axium/server'),
|
|
35
|
+
core: await getVersionInfo('@axium/core'),
|
|
36
|
+
client: await getVersionInfo('@axium/client'),
|
|
37
|
+
},
|
|
34
38
|
};
|
|
35
39
|
},
|
|
36
40
|
});
|
|
@@ -38,7 +42,9 @@ addRoute({
|
|
|
38
42
|
path: '/api/admin/plugins',
|
|
39
43
|
async GET(req) {
|
|
40
44
|
await assertAdmin(this, req);
|
|
41
|
-
return Array.
|
|
45
|
+
return await Array.fromAsync(plugins
|
|
46
|
+
.values()
|
|
47
|
+
.map(async (p) => Object.assign(omit(p, '_hooks', '_client'), p.update_checks ? await getVersionInfo(p.specifier, p.loadedBy) : { latest: null })));
|
|
42
48
|
},
|
|
43
49
|
});
|
|
44
50
|
addRoute({
|
package/dist/api/metadata.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { apps } from '@axium/core';
|
|
2
|
-
import { plugins } from '@axium/core/plugins';
|
|
3
2
|
import { requestMethods } from '@axium/core/requests';
|
|
4
|
-
import pkg from '../../package.json' with { type: 'json' };
|
|
5
3
|
import { requireSession } from '../auth.js';
|
|
6
4
|
import { config } from '../config.js';
|
|
5
|
+
import { getAllVersions } from '../io.js';
|
|
7
6
|
import { error } from '../requests.js';
|
|
8
7
|
import { addRoute, routes } from '../routes.js';
|
|
9
8
|
addRoute({
|
|
@@ -15,7 +14,7 @@ addRoute({
|
|
|
15
14
|
error(403, 'User is not an administrator');
|
|
16
15
|
}
|
|
17
16
|
return {
|
|
18
|
-
|
|
17
|
+
versions: await getAllVersions(),
|
|
19
18
|
routes: Object.fromEntries(routes
|
|
20
19
|
.entries()
|
|
21
20
|
.filter(([path]) => path.startsWith('/api/'))
|
|
@@ -26,7 +25,6 @@ addRoute({
|
|
|
26
25
|
methods: requestMethods.filter(m => m in route),
|
|
27
26
|
},
|
|
28
27
|
])),
|
|
29
|
-
plugins: Object.fromEntries(plugins.values().map(plugin => [plugin.name, plugin.version])),
|
|
30
28
|
};
|
|
31
29
|
},
|
|
32
30
|
});
|
package/dist/auth.js
CHANGED
|
@@ -120,6 +120,7 @@ export async function checkAuthForItem(request, itemType, itemId, permissions) {
|
|
|
120
120
|
error(401, 'Missing token');
|
|
121
121
|
const session = await getSessionAndUser(token).catch(() => null);
|
|
122
122
|
const { userId, user } = session ?? {};
|
|
123
|
+
// Note: we need to do casting because of TS limitations with generics
|
|
123
124
|
const item = await db
|
|
124
125
|
.selectFrom(itemType)
|
|
125
126
|
.selectAll()
|
package/dist/io.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PackageVersionInfo } from '@axium/core/packages';
|
|
1
2
|
import { Logger } from 'logzen';
|
|
2
3
|
export declare const systemDir = "/etc/axium";
|
|
3
4
|
export declare const dirs: string[];
|
|
@@ -23,3 +24,4 @@ export interface PortOptions {
|
|
|
23
24
|
* If the origin has a port, passkeys do not work correctly with some password managers.
|
|
24
25
|
*/
|
|
25
26
|
export declare function restrictedPorts(opt: PortOptions): Promise<void>;
|
|
27
|
+
export declare function getAllVersions(): Promise<PackageVersionInfo[]>;
|
package/dist/io.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as io from '@axium/core/node/io';
|
|
2
|
+
import { getVersionInfo } from '@axium/core/packages';
|
|
3
|
+
import { plugins } from '@axium/core/plugins';
|
|
2
4
|
import { Logger } from 'logzen';
|
|
3
5
|
import * as fs from 'node:fs';
|
|
4
6
|
import { dirname, join, resolve } from 'node:path/posix';
|
|
@@ -77,3 +79,11 @@ export async function restrictedPorts(opt) {
|
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
}
|
|
82
|
+
export async function getAllVersions() {
|
|
83
|
+
return await Array.fromAsync([
|
|
84
|
+
...plugins.values().map(p => getVersionInfo(p.specifier, p.loadedBy)),
|
|
85
|
+
getVersionInfo('@axium/server'),
|
|
86
|
+
getVersionInfo('@axium/core'),
|
|
87
|
+
getVersionInfo('@axium/client'),
|
|
88
|
+
]);
|
|
89
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"funding": {
|
|
6
6
|
"type": "individual",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@axium/client": ">=0.9.5",
|
|
51
|
-
"@axium/core": ">=0.
|
|
51
|
+
"@axium/core": ">=0.14.0",
|
|
52
52
|
"kysely": "^0.28.0",
|
|
53
53
|
"utilium": "^2.3.8",
|
|
54
54
|
"zod": "^4.0.5"
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { Version } from '@axium/client/components';
|
|
2
3
|
import { Severity } from '@axium/core';
|
|
4
|
+
import { capitalize } from 'utilium';
|
|
3
5
|
|
|
4
6
|
const { data } = $props();
|
|
5
7
|
</script>
|
|
@@ -10,7 +12,10 @@
|
|
|
10
12
|
|
|
11
13
|
<h2>Administration</h2>
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
{#each ['server', 'core', 'client'] as name}
|
|
16
|
+
{@const info = data.versions[name]}
|
|
17
|
+
<p>Axium {capitalize(name)} <Version v={info.version} latest={info.latest} /></p>
|
|
18
|
+
{/each}
|
|
14
19
|
|
|
15
20
|
<h3><a href="/admin/users">Users</a></h3>
|
|
16
21
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { Version } from '@axium/client/components';
|
|
3
|
+
|
|
2
4
|
const { data } = $props();
|
|
3
5
|
</script>
|
|
4
6
|
|
|
@@ -10,7 +12,7 @@
|
|
|
10
12
|
|
|
11
13
|
{#each data.plugins as plugin}
|
|
12
14
|
<div class="plugin">
|
|
13
|
-
<h3>{plugin.name}<
|
|
15
|
+
<h3>{plugin.name}<Version v={plugin.version} latest={plugin.latest} /></h3>
|
|
14
16
|
<p>
|
|
15
17
|
<strong>Loaded from</strong>
|
|
16
18
|
{#if plugin.path.endsWith('/package.json')}
|
|
@@ -18,9 +20,9 @@
|
|
|
18
20
|
{:else}
|
|
19
21
|
<span class="path">{plugin.path}</span>
|
|
20
22
|
{/if}
|
|
21
|
-
{#if plugin.
|
|
23
|
+
{#if plugin.loadedBy}
|
|
22
24
|
by
|
|
23
|
-
<a class="path" href="/admin/config#{plugin.
|
|
25
|
+
<a class="path" href="/admin/config#{plugin.loadedBy}">{plugin.loadedBy}</a>
|
|
24
26
|
{/if}
|
|
25
27
|
</p>
|
|
26
28
|
<p><strong>Author:</strong> {plugin.author}</p>
|