@axium/server 0.6.2 → 0.6.4
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/cli.js +1 -1
- package/dist/database.d.ts +1 -0
- package/dist/database.js +7 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -189,7 +189,6 @@ program
|
|
|
189
189
|
catch {
|
|
190
190
|
output.error('Unavailable');
|
|
191
191
|
}
|
|
192
|
-
await db.database.destroy();
|
|
193
192
|
console.log(styleText('whiteBright', 'Credentials authentication:'), config.auth.credentials ? styleText('yellow', 'enabled') : 'disabled');
|
|
194
193
|
console.log(styleText('whiteBright', 'Loaded plugins:'), Array.from(plugins)
|
|
195
194
|
.map(plugin => plugin.id)
|
|
@@ -200,6 +199,7 @@ program
|
|
|
200
199
|
console.log(styleText('bold', plugin.name + ':'));
|
|
201
200
|
console.log(await plugin.statusText());
|
|
202
201
|
}
|
|
202
|
+
await db.database.destroy();
|
|
203
203
|
});
|
|
204
204
|
program
|
|
205
205
|
.command('ports')
|
package/dist/database.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export interface Stats {
|
|
|
56
56
|
accounts: number;
|
|
57
57
|
sessions: number;
|
|
58
58
|
}
|
|
59
|
+
export declare function count(table: keyof Schema): Promise<number>;
|
|
59
60
|
export declare function status(): Promise<Stats>;
|
|
60
61
|
export declare function statusText(): Promise<string>;
|
|
61
62
|
export interface OpOptions extends MaybeOutput {
|
package/dist/database.js
CHANGED
|
@@ -70,12 +70,15 @@ export function connect() {
|
|
|
70
70
|
});
|
|
71
71
|
return database;
|
|
72
72
|
}
|
|
73
|
-
export async function
|
|
73
|
+
export async function count(table) {
|
|
74
74
|
const db = connect();
|
|
75
|
+
return (await db.selectFrom(table).select(db.fn.countAll().as('count')).executeTakeFirstOrThrow()).count;
|
|
76
|
+
}
|
|
77
|
+
export async function status() {
|
|
75
78
|
return {
|
|
76
|
-
users:
|
|
77
|
-
accounts:
|
|
78
|
-
sessions:
|
|
79
|
+
users: await count('User'),
|
|
80
|
+
accounts: await count('Account'),
|
|
81
|
+
sessions: await count('Session'),
|
|
79
82
|
};
|
|
80
83
|
}
|
|
81
84
|
export async function statusText() {
|