@axium/client 0.9.8 → 0.9.10
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/config.d.ts +3 -1
- package/dist/cli/config.js +2 -10
- package/dist/cli/index.js +8 -8
- package/dist/config.d.ts +3 -1
- package/lib/Preferences.svelte +3 -3
- package/lib/Version.svelte +5 -1
- package/package.json +2 -2
package/dist/cli/config.d.ts
CHANGED
package/dist/cli/config.js
CHANGED
|
@@ -3,7 +3,6 @@ import { loadPlugin } from '@axium/core/node/plugins';
|
|
|
3
3
|
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
5
|
import { join } from 'node:path/posix';
|
|
6
|
-
import * as z from 'zod';
|
|
7
6
|
import { ClientConfig, config } from '../config.js';
|
|
8
7
|
import { fetchAPI, setPrefix, setToken } from '../requests.js';
|
|
9
8
|
import { getCurrentSession } from '../user.js';
|
|
@@ -32,14 +31,7 @@ export async function loadConfig(safe) {
|
|
|
32
31
|
await loadPlugin('client', plugin, axcConfig, safe);
|
|
33
32
|
}
|
|
34
33
|
catch (e) {
|
|
35
|
-
io.warn('Failed to load config: ' +
|
|
36
|
-
(e instanceof z.core.$ZodError
|
|
37
|
-
? z.prettifyError(e)
|
|
38
|
-
: e instanceof Error
|
|
39
|
-
? io._debugOutput
|
|
40
|
-
? e.stack
|
|
41
|
-
: e.message
|
|
42
|
-
: String(e)));
|
|
34
|
+
io.warn('Failed to load config: ' + io.errorText(e));
|
|
43
35
|
}
|
|
44
36
|
}
|
|
45
37
|
export function saveConfig() {
|
|
@@ -51,7 +43,7 @@ export async function updateCache(force) {
|
|
|
51
43
|
if (!force && config.cache && config.cache.fetched + _dayMs > Date.now())
|
|
52
44
|
return;
|
|
53
45
|
io.start('Fetching metadata');
|
|
54
|
-
const [session, apps] = await Promise.all([getCurrentSession(), fetchAPI('GET', 'apps')]).catch(
|
|
46
|
+
const [session, apps] = await Promise.all([getCurrentSession(), fetchAPI('GET', 'apps')]).catch(io.exit);
|
|
55
47
|
try {
|
|
56
48
|
config.cache = { fetched: Date.now(), session, apps };
|
|
57
49
|
saveConfig();
|
package/dist/cli/index.js
CHANGED
|
@@ -51,7 +51,7 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
51
51
|
var e = new Error(message);
|
|
52
52
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
53
53
|
});
|
|
54
|
-
import {
|
|
54
|
+
import { io, outputDaemonStatus, pluginText } from '@axium/core/node';
|
|
55
55
|
import { _findPlugin, plugins } from '@axium/core/plugins';
|
|
56
56
|
import { program } from 'commander';
|
|
57
57
|
import { createServer } from 'node:http';
|
|
@@ -88,17 +88,17 @@ try {
|
|
|
88
88
|
.configureHelp({ showGlobalOptions: true })
|
|
89
89
|
.option('--debug', 'override debug mode')
|
|
90
90
|
.option('--no-debug', 'override debug mode')
|
|
91
|
-
.option('--refresh-session', 'Force a refresh of session and user metadata from server')
|
|
92
|
-
.option('--cache-only', 'Run entirely from local cache, even if it is expired.')
|
|
93
|
-
.option('--safe', 'do not execute code from plugins')
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const opt = action.optsWithGlobals();
|
|
91
|
+
.option('--refresh-session', 'Force a refresh of session and user metadata from server', false)
|
|
92
|
+
.option('--cache-only', 'Run entirely from local cache, even if it is expired.', false)
|
|
93
|
+
.option('--safe', 'do not execute code from plugins', false)
|
|
94
|
+
.hook('preAction', async (axc, action) => {
|
|
95
|
+
const opt = axc.optsWithGlobals();
|
|
97
96
|
if (!config.token)
|
|
98
97
|
return;
|
|
99
98
|
if (!opt.cacheOnly && action.name() != 'login')
|
|
100
99
|
await updateCache(opt.refreshSession);
|
|
101
100
|
});
|
|
101
|
+
program.on('option:debug', () => io._setDebugOutput(true));
|
|
102
102
|
program
|
|
103
103
|
.command('login')
|
|
104
104
|
.description('Log in to your account on an Axium server')
|
|
@@ -202,7 +202,7 @@ try {
|
|
|
202
202
|
.description('List loaded plugins')
|
|
203
203
|
.option('-l, --long', 'use the long listing format')
|
|
204
204
|
.option('--no-versions', 'do not show plugin versions')
|
|
205
|
-
.action(
|
|
205
|
+
.action(opt => {
|
|
206
206
|
if (!plugins.size) {
|
|
207
207
|
console.log('No plugins loaded.');
|
|
208
208
|
return;
|
package/dist/config.d.ts
CHANGED
|
@@ -16,7 +16,9 @@ export declare const ClientConfig: z.ZodObject<{
|
|
|
16
16
|
email: z.ZodEmail;
|
|
17
17
|
emailVerified: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
18
18
|
image: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
19
|
-
preferences: z.
|
|
19
|
+
preferences: z.ZodObject<{
|
|
20
|
+
debug: z.ZodBoolean;
|
|
21
|
+
}, z.core.$strip>;
|
|
20
22
|
roles: z.ZodArray<z.ZodString>;
|
|
21
23
|
registeredAt: z.ZodCoercedDate<unknown>;
|
|
22
24
|
isAdmin: z.ZodBoolean;
|
package/lib/Preferences.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { preferenceLabels,
|
|
2
|
+
import { preferenceLabels, Preferences } from '@axium/core';
|
|
3
3
|
import Preference from './Preference.svelte';
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
const id = $props.id();
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
|
-
{#each Object.keys(
|
|
14
|
+
{#each Object.keys(Preferences.shape) as (keyof Preferences)[] as path}
|
|
15
15
|
<div class="pref">
|
|
16
16
|
<label for={id}>{preferenceLabels[path]}</label>
|
|
17
|
-
<Preference {userId} bind:preferences {path} schema={
|
|
17
|
+
<Preference {userId} bind:preferences {path} schema={Preferences.shape[path]} />
|
|
18
18
|
</div>
|
|
19
19
|
{/each}
|
|
20
20
|
|
package/lib/Version.svelte
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<style>
|
|
18
18
|
.latest {
|
|
19
19
|
font-size: 0.9em;
|
|
20
|
-
background-color: var(--bg-
|
|
20
|
+
background-color: var(--bg-strong);
|
|
21
21
|
padding: 0.25em 0.75em;
|
|
22
22
|
border-radius: 1em;
|
|
23
23
|
}
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
:global(h1 h2, h3, h4, h5, h6) {
|
|
26
26
|
.latest {
|
|
27
27
|
margin-left: 1em;
|
|
28
|
+
|
|
29
|
+
.version {
|
|
30
|
+
margin-left: unset;
|
|
31
|
+
}
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
</style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/client",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.10",
|
|
4
4
|
"author": "James Prevett <jp@jamespre.dev>",
|
|
5
5
|
"funding": {
|
|
6
6
|
"type": "individual",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"build": "tsc"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@axium/core": ">=0.
|
|
43
|
+
"@axium/core": ">=0.15.0",
|
|
44
44
|
"utilium": "^2.3.8",
|
|
45
45
|
"zod": "^4.0.5",
|
|
46
46
|
"svelte": "^5.36.0"
|