@axium/storage 0.21.4 → 0.21.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/server/hooks.js +3 -9
- package/package.json +3 -2
package/dist/server/hooks.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getConfig } from '@axium/core';
|
|
2
2
|
import { formatBytes } from '@axium/core/format';
|
|
3
|
-
import { done, start } from 'ioium/node';
|
|
4
3
|
import { count, database } from '@axium/server/database';
|
|
4
|
+
import { track } from 'ioium/node';
|
|
5
5
|
import { mkdirSync } from 'node:fs';
|
|
6
6
|
import '../common.js';
|
|
7
|
-
import './index.js';
|
|
8
7
|
import { getTotalUse } from './db.js';
|
|
8
|
+
import './index.js';
|
|
9
9
|
export function load() {
|
|
10
10
|
mkdirSync(getConfig('@axium/storage').data, { recursive: true });
|
|
11
11
|
}
|
|
@@ -15,12 +15,6 @@ export async function statusText() {
|
|
|
15
15
|
return `${items} items totaling ${formatBytes(size)}`;
|
|
16
16
|
}
|
|
17
17
|
export async function clean(opt) {
|
|
18
|
-
start('Removing expired trash items');
|
|
19
18
|
const nDaysAgo = new Date(Date.now() - 86400000 * getConfig('@axium/storage').trash_duration);
|
|
20
|
-
await database
|
|
21
|
-
.deleteFrom('storage')
|
|
22
|
-
.where('trashedAt', 'is not', null)
|
|
23
|
-
.where('trashedAt', '<', nDaysAgo)
|
|
24
|
-
.executeTakeFirstOrThrow()
|
|
25
|
-
.then(done);
|
|
19
|
+
await track('Removing expired trash items', database.deleteFrom('storage').where('trashedAt', 'is not', null).where('trashedAt', '<', nDaysAgo).executeTakeFirstOrThrow());
|
|
26
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/storage",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.6",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"description": "User file storage for Axium",
|
|
6
6
|
"funding": {
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"@axium/core": ">=0.26.0",
|
|
45
45
|
"@axium/server": ">=0.39.0",
|
|
46
46
|
"@sveltejs/kit": "^2.27.3",
|
|
47
|
-
"
|
|
47
|
+
"commander": "^14.0.0",
|
|
48
|
+
"ioium": "^1.1.0",
|
|
48
49
|
"kysely": "^0.28.15",
|
|
49
50
|
"mime": "^4.1.0",
|
|
50
51
|
"utilium": "^3.0.0"
|