refactor(types): rename AppType to AppId for semantic clarity

Rename `AppType` to `AppId` across the entire frontend codebase to better
reflect its purpose as an application identifier rather than a type category.
This aligns frontend naming with backend command parameter conventions.

Changes:
- Rename type `AppType` to `AppId` in src/lib/api/types.ts
- Remove `AppType` export from src/lib/api/index.ts
- Update all component props from `appType` to `appId` (43 files)
- Update all variable names from `appType` to `appId`
- Synchronize documentation (CHANGELOG, refactoring plans)
- Update test files and MSW mocks

BREAKING CHANGE: `AppType` type is no longer exported. Use `AppId` instead.
All component props have been renamed from `appType` to `appId`.
This commit is contained in:
Jason
2025-10-30 14:59:15 +08:00
parent 80dd6e9381
commit 8e4a0a1bbb
43 changed files with 327 additions and 347 deletions

View File

@@ -1,6 +1,6 @@
import { invoke } from "@tauri-apps/api/core";
import type { CustomEndpoint } from "@/types";
import type { AppType } from "./types";
import type { AppId } from "./types";
export interface EndpointLatencyResult {
url: string;
@@ -10,8 +10,8 @@ export interface EndpointLatencyResult {
}
export const vscodeApi = {
async getLiveProviderSettings(appType: AppType) {
return await invoke("read_live_provider_settings", { app: appType });
async getLiveProviderSettings(appId: AppId) {
return await invoke("read_live_provider_settings", { app: appId });
},
async testApiEndpoints(
@@ -25,46 +25,46 @@ export const vscodeApi = {
},
async getCustomEndpoints(
appType: AppType,
appId: AppId,
providerId: string,
): Promise<CustomEndpoint[]> {
return await invoke("get_custom_endpoints", {
app: appType,
app: appId,
provider_id: providerId,
});
},
async addCustomEndpoint(
appType: AppType,
appId: AppId,
providerId: string,
url: string,
): Promise<void> {
await invoke("add_custom_endpoint", {
app: appType,
app: appId,
provider_id: providerId,
url,
});
},
async removeCustomEndpoint(
appType: AppType,
appId: AppId,
providerId: string,
url: string,
): Promise<void> {
await invoke("remove_custom_endpoint", {
app: appType,
app: appId,
provider_id: providerId,
url,
});
},
async updateEndpointLastUsed(
appType: AppType,
appId: AppId,
providerId: string,
url: string,
): Promise<void> {
await invoke("update_endpoint_last_used", {
app: appType,
app: appId,
provider_id: providerId,
url,
});