@axium/server 0.28.4 → 0.28.6

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 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
- } & Record<string, any>;
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,5 +1,5 @@
1
1
  import { AuditFilter, Severity } from '@axium/core';
2
- import { plugins } from '@axium/core/plugins';
2
+ import { getVersionInfo, plugins } from '@axium/core/plugins';
3
3
  import { jsonArrayFrom, jsonObjectFrom } from 'kysely/helpers/postgres';
4
4
  import { omit } from 'utilium';
5
5
  import * as z from 'zod';
@@ -38,7 +38,7 @@ addRoute({
38
38
  path: '/api/admin/plugins',
39
39
  async GET(req) {
40
40
  await assertAdmin(this, req);
41
- return Array.from(plugins.values()).map(p => omit(p, '_hooks'));
41
+ return await Array.fromAsync(plugins.values().map(async (p) => Object.assign(omit(p, '_hooks', '_client'), await getVersionInfo(p))));
42
42
  },
43
43
  });
44
44
  addRoute({
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/server",
3
- "version": "0.28.4",
3
+ "version": "0.28.6",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "funding": {
6
6
  "type": "individual",
@@ -47,7 +47,7 @@
47
47
  "clean": "rm -rf build .svelte-kit node_modules/{.vite,.vite-temp}"
48
48
  },
49
49
  "peerDependencies": {
50
- "@axium/client": ">=0.9.0",
50
+ "@axium/client": ">=0.9.5",
51
51
  "@axium/core": ">=0.12.0",
52
52
  "kysely": "^0.28.0",
53
53
  "utilium": "^2.3.8",
@@ -96,23 +96,31 @@
96
96
  <h3>Passkeys</h3>
97
97
  {#each passkeys as passkey}
98
98
  <div class="item passkey">
99
- <dfn title={passkey.deviceType == 'multiDevice' ? 'Multiple devices' : 'Single device'}>
100
- <Icon i={passkey.deviceType == 'multiDevice' ? 'laptop-mobile' : 'mobile'} --size="16px" />
101
- </dfn>
102
- <dfn title="This passkey is {passkey.backedUp ? '' : 'not '}backed up">
103
- <Icon i={passkey.backedUp ? 'circle-check' : 'circle-xmark'} --size="16px" />
104
- </dfn>
105
- {#if passkey.name}
106
- <p>{passkey.name}</p>
107
- {:else}
108
- <p class="subtle"><i>Unnamed</i></p>
109
- {/if}
99
+ <p>
100
+ <dfn title={passkey.deviceType == 'multiDevice' ? 'Multiple devices' : 'Single device'}>
101
+ <Icon i={passkey.deviceType == 'multiDevice' ? 'laptop-mobile' : 'mobile'} --size="16px" />
102
+ </dfn>
103
+ <dfn title="This passkey is {passkey.backedUp ? '' : 'not '}backed up">
104
+ <Icon i={passkey.backedUp ? 'circle-check' : 'circle-xmark'} --size="16px" />
105
+ </dfn>
106
+ {#if passkey.name}
107
+ <p>{passkey.name}</p>
108
+ {:else}
109
+ <p class="subtle"><i>Unnamed</i></p>
110
+ {/if}
111
+ </p>
110
112
  <p>Created {passkey.createdAt.toLocaleString()}</p>
111
- {@render action('edit_passkey:' + passkey.id)}
113
+ <button commandfor="edit_passkey:{passkey.id}" command="show-modal" class="icon-text">
114
+ <Icon i="pen" --size="16px" />
115
+ <span class="mobile-only">Rename</span>
116
+ </button>
112
117
  {#if passkeys.length > 1}
113
- {@render action('delete_passkey:' + passkey.id, 'trash')}
118
+ <button commandfor="delete_passkey:{passkey.id}" command="show-modal" class="icon-text">
119
+ <Icon i="trash" --size="16px" />
120
+ <span class="mobile-only">Delete</span>
121
+ </button>
114
122
  {:else}
115
- <dfn title="You must have at least one passkey" class="disabled">
123
+ <dfn title="You must have at least one passkey" class="disabled icon-text mobile-hide">
116
124
  <Icon i="trash-slash" --fill="#888" --size="16px" />
117
125
  </dfn>
118
126
  {/if}
@@ -1,4 +1,5 @@
1
1
  <script>
2
+ import { Version } from '@axium/client/components';
2
3
  import { Severity } from '@axium/core';
3
4
 
4
5
  const { data } = $props();
@@ -10,7 +11,7 @@
10
11
 
11
12
  <h2>Administration</h2>
12
13
 
13
- <p>Axium Server <span class="version">{data.version}</span></p>
14
+ <p>Axium Server <Version v={data.version} latest={data.latest} /></p>
14
15
 
15
16
  <h3><a href="/admin/users">Users</a></h3>
16
17
 
@@ -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}<span class="version">{plugin.version}</span></h3>
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._loadedBy}
23
+ {#if plugin.loadedBy}
22
24
  by
23
- <a class="path" href="/admin/config#{plugin._loadedBy}">{plugin._loadedBy}</a>
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>