refactor(types): move shared types from renderer to shared directory

- Move type definitions from src/renderer/src/types/ to src/shared/types/
- Add @shared/* path alias to tsconfig.node.json and tsconfig.web.json
- Update all imports from @renderer/types/* to @shared/types/*
- Update AGENTS.md with new directory structure and path alias

This fixes architecture violation where main/preload processes imported
from renderer directory. Types are now properly shared across all processes.
This commit is contained in:
2026-03-12 12:57:21 +08:00
parent 1e9a01b6c1
commit 0945d7f0b2
22 changed files with 41 additions and 41 deletions

View File

@@ -11,16 +11,13 @@ import {
getDomain,
deleteDomain,
listDomains,
saveVersion,
listVersions,
deleteVersion,
saveDownload,
saveBackup,
isSecureStorageAvailable,
getStorageBackend,
} from "./storage";
import { KintoneClient, KintoneError } from "./kintone-api";
import type { Result } from "@renderer/types/ipc";
import { KintoneClient, createKintoneClient } from "./kintone-api";
import type { Result } from "@shared/types/ipc";
import type {
CreateDomainParams,
UpdateDomainParams,
@@ -35,13 +32,13 @@ import type {
DownloadResult,
GetVersionsParams,
RollbackParams,
} from "@renderer/types/ipc";
import type { Domain, DomainWithStatus } from "@renderer/types/domain";
} from "@shared/types/ipc";
import type { Domain, DomainWithStatus, DomainWithPassword } from "@shared/types/domain";
import type {
Version,
DownloadMetadata,
BackupMetadata,
} from "@renderer/types/version";
} from "@shared/types/version";
// Cache for Kintone clients
const clientCache = new Map<string, KintoneClient>();
@@ -59,7 +56,7 @@ async function getClient(domainId: string): Promise<KintoneClient> {
throw new Error(`Domain not found: ${domainId}`);
}
const client = new KintoneClient(domainWithPassword);
const client = createKintoneClient(domainWithPassword);
clientCache.set(domainId, client);
return client;
}
@@ -196,7 +193,7 @@ function registerTestConnection(): void {
throw new Error(`Domain not found: ${id}`);
}
const client = new KintoneClient(domainWithPassword);
const client = createKintoneClient(domainWithPassword);
const result = await client.testConnection();
return {
@@ -226,7 +223,7 @@ function registerTestDomainConnection(): void {
updatedAt: new Date().toISOString(),
};
const client = new KintoneClient(tempDomain);
const client = createKintoneClient(tempDomain);
const result = await client.testConnection();
if (!result.success) {