sh3-core 0.1.0 → 0.2.0
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.
Potentially problematic release.
This version of sh3-core might be problematic. Click here for more details.
- package/dist/api.d.ts +1 -0
- package/dist/assets/icons.svg +1119 -1119
- package/dist/auth/auth.svelte.d.ts +6 -0
- package/dist/auth/auth.svelte.js +8 -0
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/createShell.d.ts +31 -0
- package/dist/createShell.js +109 -0
- package/dist/diagnostic/DiagnosticPanel.svelte +106 -0
- package/dist/diagnostic/DiagnosticPanel.svelte.d.ts +3 -0
- package/dist/diagnostic/DiagnosticPromptModal.svelte +82 -0
- package/dist/diagnostic/DiagnosticPromptModal.svelte.d.ts +8 -0
- package/dist/diagnostic/diagnosticApp.d.ts +2 -0
- package/dist/diagnostic/diagnosticApp.js +24 -0
- package/dist/diagnostic/diagnosticShard.svelte.d.ts +2 -0
- package/dist/diagnostic/diagnosticShard.svelte.js +106 -0
- package/dist/host-entry.d.ts +4 -1
- package/dist/host-entry.js +3 -1
- package/dist/host.d.ts +10 -1
- package/dist/host.js +34 -22
- package/dist/platform/index.d.ts +10 -0
- package/dist/platform/index.js +37 -0
- package/dist/platform/tauri-backend.d.ts +15 -0
- package/dist/platform/tauri-backend.js +58 -0
- package/dist/registry/schema.js +5 -0
- package/dist/registry/types.d.ts +20 -3
- package/dist/server-shard/types.d.ts +67 -0
- package/dist/server-shard/types.js +13 -0
- package/dist/shards/types.d.ts +8 -0
- package/package.json +1 -1
- package/dist/registry-shard/RegistryView.svelte +0 -561
- package/dist/registry-shard/RegistryView.svelte.d.ts +0 -3
- package/dist/registry-shard/registryApp.d.ts +0 -10
- package/dist/registry-shard/registryApp.js +0 -24
- package/dist/registry-shard/registryShard.svelte.d.ts +0 -45
- package/dist/registry-shard/registryShard.svelte.js +0 -125
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Registry shard — framework-shipped shard for managing packages on the
|
|
3
|
-
* local SH3 server's registry.
|
|
4
|
-
*
|
|
5
|
-
* Contributes one view:
|
|
6
|
-
* - `sh3-registry:manage` — package list, publish, edit, update, delete
|
|
7
|
-
*
|
|
8
|
-
* Auth is handled via getAuthHeader() from the framework's auth module.
|
|
9
|
-
* No user zone — all server calls include the Authorization header
|
|
10
|
-
* automatically.
|
|
11
|
-
*
|
|
12
|
-
* `.svelte.ts` because mounting Svelte components requires rune access.
|
|
13
|
-
*/
|
|
14
|
-
import { mount, unmount } from 'svelte';
|
|
15
|
-
import RegistryView from './RegistryView.svelte';
|
|
16
|
-
import { getAuthHeader } from '../auth/index';
|
|
17
|
-
/**
|
|
18
|
-
* Module-level context set during activate(). Imported by the Svelte
|
|
19
|
-
* view component so it can read/write state and trigger actions.
|
|
20
|
-
*/
|
|
21
|
-
export let registryContext = undefined;
|
|
22
|
-
/** Build fetch headers with auth. Throws if not elevated. */
|
|
23
|
-
function authHeaders(contentType) {
|
|
24
|
-
const auth = getAuthHeader();
|
|
25
|
-
const headers = {};
|
|
26
|
-
if (auth)
|
|
27
|
-
headers['Authorization'] = auth;
|
|
28
|
-
if (contentType)
|
|
29
|
-
headers['Content-Type'] = contentType;
|
|
30
|
-
return headers;
|
|
31
|
-
}
|
|
32
|
-
/** Server base URL — same-origin. */
|
|
33
|
-
const apiBase = '';
|
|
34
|
-
export const registryShard = {
|
|
35
|
-
manifest: {
|
|
36
|
-
id: 'sh3-registry',
|
|
37
|
-
label: 'Registry Manager',
|
|
38
|
-
version: '0.1.0',
|
|
39
|
-
views: [
|
|
40
|
-
{ id: 'sh3-registry:manage', label: 'Registry' },
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
activate(ctx) {
|
|
44
|
-
const state = ctx.state({
|
|
45
|
-
ephemeral: {
|
|
46
|
-
packages: [],
|
|
47
|
-
loading: false,
|
|
48
|
-
error: null,
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
async function refreshPackages() {
|
|
52
|
-
var _a;
|
|
53
|
-
state.ephemeral.loading = true;
|
|
54
|
-
state.ephemeral.error = null;
|
|
55
|
-
try {
|
|
56
|
-
const res = await fetch(`${apiBase}/registry.json`);
|
|
57
|
-
if (!res.ok)
|
|
58
|
-
throw new Error(`HTTP ${res.status} ${res.statusText}`);
|
|
59
|
-
const data = await res.json();
|
|
60
|
-
state.ephemeral.packages = (_a = data.packages) !== null && _a !== void 0 ? _a : [];
|
|
61
|
-
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
state.ephemeral.error = err instanceof Error ? err.message : String(err);
|
|
64
|
-
}
|
|
65
|
-
finally {
|
|
66
|
-
state.ephemeral.loading = false;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async function publishPackage(form) {
|
|
70
|
-
var _a;
|
|
71
|
-
const res = await fetch(`${apiBase}/api/registry/publish`, {
|
|
72
|
-
method: 'POST',
|
|
73
|
-
headers: authHeaders(),
|
|
74
|
-
body: form,
|
|
75
|
-
});
|
|
76
|
-
if (!res.ok) {
|
|
77
|
-
const data = await res.json().catch(() => ({ error: res.statusText }));
|
|
78
|
-
throw new Error((_a = data.error) !== null && _a !== void 0 ? _a : `HTTP ${res.status}`);
|
|
79
|
-
}
|
|
80
|
-
await refreshPackages();
|
|
81
|
-
}
|
|
82
|
-
async function patchPackage(id, fields) {
|
|
83
|
-
var _a;
|
|
84
|
-
const res = await fetch(`${apiBase}/api/registry/packages/${id}`, {
|
|
85
|
-
method: 'PATCH',
|
|
86
|
-
headers: authHeaders('application/json'),
|
|
87
|
-
body: JSON.stringify(fields),
|
|
88
|
-
});
|
|
89
|
-
if (!res.ok) {
|
|
90
|
-
const data = await res.json().catch(() => ({ error: res.statusText }));
|
|
91
|
-
throw new Error((_a = data.error) !== null && _a !== void 0 ? _a : `HTTP ${res.status}`);
|
|
92
|
-
}
|
|
93
|
-
await refreshPackages();
|
|
94
|
-
}
|
|
95
|
-
async function deletePackage(id) {
|
|
96
|
-
var _a;
|
|
97
|
-
const res = await fetch(`${apiBase}/api/registry/packages/${id}`, {
|
|
98
|
-
method: 'DELETE',
|
|
99
|
-
headers: authHeaders(),
|
|
100
|
-
});
|
|
101
|
-
if (!res.ok) {
|
|
102
|
-
const data = await res.json().catch(() => ({ error: res.statusText }));
|
|
103
|
-
throw new Error((_a = data.error) !== null && _a !== void 0 ? _a : `HTTP ${res.status}`);
|
|
104
|
-
}
|
|
105
|
-
await refreshPackages();
|
|
106
|
-
}
|
|
107
|
-
// Set the module-level context so the view component can import it.
|
|
108
|
-
registryContext = { state, refreshPackages, publishPackage, patchPackage, deletePackage };
|
|
109
|
-
const manageFactory = {
|
|
110
|
-
mount(container, _context) {
|
|
111
|
-
const instance = mount(RegistryView, { target: container });
|
|
112
|
-
void refreshPackages();
|
|
113
|
-
return {
|
|
114
|
-
unmount() {
|
|
115
|
-
unmount(instance);
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
ctx.registerView('sh3-registry:manage', manageFactory);
|
|
121
|
-
},
|
|
122
|
-
autostart() {
|
|
123
|
-
// Self-starting so the view is available from the launcher.
|
|
124
|
-
},
|
|
125
|
-
};
|