feat(wails): move the frontend onto v3's generated bindings
frontend/wailsjs/ is deleted and frontend/bindings/ takes its place — a real TypeScript module tree nested by Go import path, generated by wails3's static analyser rather than by building the app and running it. The @go alias absorbs the constant prefix, so a call site imports '@go/library/library.js' and the codemod over all 93 sites was a specifier rewrite plus splitting @go/models' namespaces into one import per package. The 12 SetContext bindings and the fake `context` model are gone, as Phase 2's ServiceStartup port promised: 272 methods across 12 services, none of them plumbing. @runtime/runtime is now a local shim (src/wails/runtime.ts) over @wailsio/runtime, so the 22 EventsOn imports are untouched. It unwraps v3's WailsEvent into v2's callback shape, which is exact here: nothing in backend/events passes more than one data argument, and v3 only packs arguments into a slice when there is more than one. v3 tells the truth about two things v2 lied about, and that is most of the diff. A Go nil slice really does arrive as JSON null, and a Go named string type really is an enum; v2 typed them as T[] and string. utils/binding.ts states the app's actual contract — an absent list is an empty list — once, at the boundary where it is true, and also drops the CancellablePromise the app never cancels. Four test fixtures widen an enum field back to its value union. Not done, and Phase 5's to fix: frontend/test/support/wails-fake.ts still fakes window.go, which v3 does not have, so `make ui-test` is broken and harness.test.ts fails to compile on EventsEmit. That test also asserts v2 ordering that no longer holds — v3's Events.Emit calls the backend and does not notify in-page listeners at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UDCbcCZQepnpSQYJ6SxxZm
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import * as Service from "./service.js";
|
||||
export {
|
||||
Service
|
||||
};
|
||||
|
||||
export {
|
||||
Kind,
|
||||
Level,
|
||||
State
|
||||
} from "./models.js";
|
||||
|
||||
export type {
|
||||
Caps,
|
||||
Job,
|
||||
LogEntry,
|
||||
Registry,
|
||||
Stage,
|
||||
Stat
|
||||
} from "./models.js";
|
||||
@@ -0,0 +1,159 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
/**
|
||||
* Caps describes which controls a job supports. The frontend renders
|
||||
* buttons from these rather than switching on Kind, so a job that gains
|
||||
* pause support later needs no frontend change.
|
||||
*/
|
||||
export interface Caps {
|
||||
"pausable": boolean;
|
||||
"cancellable": boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Job is the frontend-facing snapshot of a single background job.
|
||||
*/
|
||||
export interface Job {
|
||||
"id": string;
|
||||
"kind": Kind;
|
||||
"title": string;
|
||||
"subtitle"?: string;
|
||||
"state": State;
|
||||
"phase"?: string;
|
||||
|
||||
/**
|
||||
* Current/Total drive the progress bar. Total == 0 means the job
|
||||
* is indeterminate and the frontend should render a spinner.
|
||||
*/
|
||||
"current": number;
|
||||
"total": number;
|
||||
"caps": Caps;
|
||||
"stages": Stage[] | null;
|
||||
"stats": Stat[] | null;
|
||||
"error"?: string;
|
||||
|
||||
/**
|
||||
* unix milliseconds
|
||||
*/
|
||||
"startedAt": number;
|
||||
"updatedAt": number;
|
||||
"endedAt"?: number;
|
||||
"logCount": number;
|
||||
"warnCount": number;
|
||||
"errorCount": number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kind identifies the subsystem that owns a job. The frontend uses it
|
||||
* to pick an icon and to route "view details" to the right panel.
|
||||
*/
|
||||
export enum Kind {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
/**
|
||||
* Job kinds.
|
||||
*/
|
||||
KindLibraryScan = "library-scan",
|
||||
KindIndexBuild = "index-build",
|
||||
KindDownload = "download",
|
||||
KindAutotagApply = "autotag-apply",
|
||||
|
||||
/**
|
||||
* KindCatalogEnrich is background catalog work for content the user
|
||||
* already owns — the discography backfills. It is distinct from
|
||||
* KindIndexBuild because the two differ in what cancelling costs:
|
||||
* an index build discards hours of downloading and the frontend
|
||||
* confirms before stopping one, where a backfill is resumable per
|
||||
* artist and stopping it is free.
|
||||
*/
|
||||
KindCatalogEnrich = "catalog-enrich",
|
||||
};
|
||||
|
||||
/**
|
||||
* Level is the severity of a job log entry.
|
||||
*/
|
||||
export enum Level {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
/**
|
||||
* Log levels.
|
||||
*/
|
||||
LevelInfo = "info",
|
||||
LevelWarn = "warn",
|
||||
LevelError = "error",
|
||||
};
|
||||
|
||||
/**
|
||||
* LogEntry is one line of a job's output log.
|
||||
*/
|
||||
export interface LogEntry {
|
||||
/**
|
||||
* unix milliseconds
|
||||
*/
|
||||
"time": number;
|
||||
"level": Level;
|
||||
"message": string;
|
||||
"detail"?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registry owns every known job and pushes coalesced snapshots to the
|
||||
* frontend. It is safe for concurrent use.
|
||||
*/
|
||||
export interface Registry {
|
||||
}
|
||||
|
||||
/**
|
||||
* Stage is one named sub-step of a multi-stage job, such as an index
|
||||
* build tier. Jobs with a single linear phase leave Stages empty.
|
||||
*/
|
||||
export interface Stage {
|
||||
"name": string;
|
||||
|
||||
/**
|
||||
* pending, running, complete, error, skipped
|
||||
*/
|
||||
"state": string;
|
||||
"current": number;
|
||||
"total": number;
|
||||
"error"?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stat is a display-only key/value pair shown in the job detail panel
|
||||
* (e.g. "Added" / "1,204").
|
||||
*/
|
||||
export interface Stat {
|
||||
"label": string;
|
||||
"value": string;
|
||||
}
|
||||
|
||||
/**
|
||||
* State is the lifecycle position of a job.
|
||||
*/
|
||||
export enum State {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
/**
|
||||
* Job states. Queued, Running, Paused and Pausing are live; Complete,
|
||||
* Cancelled and Error are terminal.
|
||||
*/
|
||||
StateQueued = "queued",
|
||||
StateRunning = "running",
|
||||
StatePausing = "pausing",
|
||||
StatePaused = "paused",
|
||||
StateCancelling = "cancelling",
|
||||
StateComplete = "complete",
|
||||
StateCancelled = "cancelled",
|
||||
StateError = "error",
|
||||
};
|
||||
@@ -0,0 +1,68 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
/**
|
||||
* Service is the Wails-bound facade over the registry. It deliberately
|
||||
* exposes only the read and control surface — producers get a *Handle
|
||||
* through the registry instead, so the frontend cannot invent jobs.
|
||||
* @module
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import { Call as $Call, CancellablePromise as $CancellablePromise } from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
|
||||
/**
|
||||
* CancelJob abandons a job.
|
||||
*/
|
||||
export function CancelJob(id: string): $CancellablePromise<void> {
|
||||
return $Call.ByID(680141523, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* ClearFinishedJobs removes every terminal job from the list.
|
||||
*/
|
||||
export function ClearFinishedJobs(): $CancellablePromise<void> {
|
||||
return $Call.ByID(4219744941);
|
||||
}
|
||||
|
||||
/**
|
||||
* DismissJob removes a single finished job from the list.
|
||||
*/
|
||||
export function DismissJob(id: string): $CancellablePromise<void> {
|
||||
return $Call.ByID(1904307161, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetJobLog returns the retained log tail for one job.
|
||||
*/
|
||||
export function GetJobLog(id: string): $CancellablePromise<$models.LogEntry[] | null> {
|
||||
return $Call.ByID(441057229, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetJobs returns every known job — active first by registration order,
|
||||
* including recently finished ones so the panel can show outcomes.
|
||||
*/
|
||||
export function GetJobs(): $CancellablePromise<$models.Job[] | null> {
|
||||
return $Call.ByID(3979035366);
|
||||
}
|
||||
|
||||
/**
|
||||
* PauseJob asks the owning subsystem to pause a job. Returns
|
||||
* immediately; the job reports "paused" once it actually stops.
|
||||
*/
|
||||
export function PauseJob(id: string): $CancellablePromise<void> {
|
||||
return $Call.ByID(4094353111, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* ResumeJob continues a paused job.
|
||||
*/
|
||||
export function ResumeJob(id: string): $CancellablePromise<void> {
|
||||
return $Call.ByID(3937701508, id);
|
||||
}
|
||||
Reference in New Issue
Block a user