GraphQL, WebSocket, import, runner and CLI (M5, M6) plus packaging

- GraphQL editor with schema introspection, cached schema,
  autocomplete and explorer
- WebSocket: auth and subprotocols in the handshake, text/JSON/hex/file
  messages, saved messages, live log with filter, search and export,
  reconnect with backoff
- Import from Postman (collections and environments), Bruno, Insomnia,
  OpenAPI/Swagger and cURL; imported scripts are kept as docs, never run;
  credentials move to the gitignored secrets file
- Code snippets for cURL, fetch, Python, HTTPie, Go, PowerShell;
  Postman export
- Runner for folders and collections with JSON and JUnit reports
- knock CLI: send, run, import, auth login/debug/logout
- Large JSON responses parsed off the main thread
- PKGBUILDs, desktop entry with knock:// handler, CI workflow, README
This commit is contained in:
2026-11-27 17:13:06 +01:00
parent a469697af7
commit fc253126a7
51 changed files with 8437 additions and 24 deletions
+23 -10
View File
@@ -3,7 +3,8 @@
import CodeEditor from '$lib/editor/CodeEditor.svelte';
import JsonViewer from '$lib/json/JsonViewer.svelte';
import Icon from '$lib/ui/Icon.svelte';
import { parse, serialize, toValue, fromValue, type JNode } from '$lib/json/ast';
import { serialize, toValue, fromValue, type JNode } from '$lib/json/ast';
import { parseJson } from '$lib/json/parseAsync';
import { bodyKind } from '$lib/response';
import { formatBytes } from '$lib/request';
import type { Tab } from '$lib/state/workspace.svelte';
@@ -22,13 +23,25 @@
let viewer: JsonViewer | undefined = $state();
let wrap = $state(true);
let tree = $derived.by((): JNode | null => {
if (kind !== 'json' || text === undefined) return null;
try {
return parse(text);
} catch {
return null;
}
let tree = $state<JNode | null>(null);
let jsonPretty = $state<string | null>(null);
let parsing = $state(false);
$effect(() => {
const t = text;
tree = null;
jsonPretty = null;
if (kind !== 'json' || t === undefined) return;
parsing = true;
let stale = false;
parseJson(t).then((r) => {
if (stale) return;
tree = r.tree;
jsonPretty = r.tree ? r.pretty : null;
parsing = false;
});
return () => {
stale = true;
};
});
let isPath = $derived(query.trim().startsWith('$'));
@@ -44,7 +57,7 @@
let prettyText = $derived.by(() => {
if (text === undefined) return '';
if (kind === 'json' && tree) return serialize(tree, ' ');
if (kind === 'json' && jsonPretty !== null) return jsonPretty;
if (kind === 'xml' || kind === 'html') return prettyMarkup(text);
return text;
});
@@ -131,7 +144,7 @@
{/if}
<div class="min-h-0 flex-1">
{#if text === undefined}
{#if text === undefined || (parsing && kind === 'json' && mode !== 'raw')}
<p class="p-4 text-fg-subtle">Loading body…</p>
{:else if resp.size === 0}
<p class="p-4 text-fg-subtle">The response has no body.</p>