@axium/storage 0.5.0 → 0.5.2
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/server.js +4 -4
- package/lib/List.svelte +9 -9
- package/lib/tsconfig.json +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -326,7 +326,7 @@ addRoute({
|
|
|
326
326
|
const userId = event.params.id;
|
|
327
327
|
await checkAuthForUser(event, userId);
|
|
328
328
|
const [items, usage, limits] = await Promise.all([
|
|
329
|
-
database.selectFrom('storage').where('userId', '=', userId).where('trashedAt', '
|
|
329
|
+
database.selectFrom('storage').where('userId', '=', userId).where('trashedAt', '!=', null).selectAll().execute(),
|
|
330
330
|
currentUsage(userId),
|
|
331
331
|
getLimits(userId),
|
|
332
332
|
]).catch(withError('Could not fetch data'));
|
|
@@ -344,8 +344,8 @@ addRoute({
|
|
|
344
344
|
const items = await database
|
|
345
345
|
.selectFrom('storage')
|
|
346
346
|
.where('userId', '=', userId)
|
|
347
|
-
.where('trashedAt', '
|
|
348
|
-
.where('parentId', '
|
|
347
|
+
.where('trashedAt', '!=', null)
|
|
348
|
+
.where('parentId', '=', null)
|
|
349
349
|
.selectAll()
|
|
350
350
|
.execute()
|
|
351
351
|
.catch(withError('Could not get storage items'));
|
|
@@ -362,7 +362,7 @@ addRoute({
|
|
|
362
362
|
await checkAuthForUser(event, userId);
|
|
363
363
|
const items = await database
|
|
364
364
|
.selectFrom('storage')
|
|
365
|
-
.where('trashedAt', '
|
|
365
|
+
.where('trashedAt', '!=', null)
|
|
366
366
|
.where(({ and, not, exists, selectFrom }) => {
|
|
367
367
|
const existsInAcl = (column) => exists(selectFrom('acl.storage')
|
|
368
368
|
.whereRef('itemId', '=', `storage.${column}`)
|
package/lib/List.svelte
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
let { items = $bindable([]), appMode }: { appMode?: boolean; items: StorageItemMetadata[] } = $props();
|
|
9
9
|
|
|
10
10
|
let activeIndex = $state<number>(-1);
|
|
11
|
-
let activeItem = $derived(items[activeIndex]);
|
|
11
|
+
let activeItem = $derived(activeIndex == -1 ? null : items[activeIndex]);
|
|
12
12
|
const dialogs = $state<Record<string, HTMLDialogElement>>({});
|
|
13
13
|
</script>
|
|
14
14
|
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
bind:dialog={dialogs.rename}
|
|
69
69
|
submitText="Rename"
|
|
70
70
|
submit={async (data: { name: string }) => {
|
|
71
|
-
await updateItemMetadata(activeItem
|
|
72
|
-
activeItem
|
|
71
|
+
await updateItemMetadata(activeItem!.id, data);
|
|
72
|
+
activeItem!.name = data.name;
|
|
73
73
|
}}
|
|
74
74
|
>
|
|
75
75
|
<div>
|
|
76
76
|
<label for="name">Name</label>
|
|
77
|
-
<input name="name" type="text" required value={activeItem
|
|
77
|
+
<input name="name" type="text" required value={activeItem?.name} />
|
|
78
78
|
</div>
|
|
79
79
|
</FormDialog>
|
|
80
80
|
<FormDialog
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
submitText="Trash"
|
|
83
83
|
submitDanger
|
|
84
84
|
submit={async () => {
|
|
85
|
-
await updateItemMetadata(activeItem
|
|
85
|
+
await updateItemMetadata(activeItem!.id, { trash: true });
|
|
86
86
|
if (activeIndex != -1) items.splice(activeIndex, 1);
|
|
87
87
|
}}
|
|
88
88
|
>
|
|
@@ -92,14 +92,14 @@
|
|
|
92
92
|
bind:dialog={dialogs.download}
|
|
93
93
|
submitText="Download"
|
|
94
94
|
submit={async () => {
|
|
95
|
-
if (activeItem
|
|
96
|
-
const children = await getDirectoryMetadata(activeItem
|
|
95
|
+
if (activeItem!.type == 'inode/directory') {
|
|
96
|
+
const children = await getDirectoryMetadata(activeItem!.id);
|
|
97
97
|
for (const child of children) open(child.dataURL, '_blank');
|
|
98
|
-
} else open(activeItem
|
|
98
|
+
} else open(activeItem!.dataURL, '_blank');
|
|
99
99
|
}}
|
|
100
100
|
>
|
|
101
101
|
<p>
|
|
102
|
-
We are not responsible for the contents of this {activeItem
|
|
102
|
+
We are not responsible for the contents of this {activeItem?.type == 'inode/directory' ? 'folder' : 'file'}. <br />
|
|
103
103
|
Are you sure you want to download {@render _itemName()}?
|
|
104
104
|
</p>
|
|
105
105
|
</FormDialog>
|
package/lib/tsconfig.json
CHANGED