cherry-studio/packages/shared/data
fullex b156ee68e0 feat(cache): enhance shared cache functionality and synchronization in main
- Introduced type-safe access methods for shared cache in the Main process, including `getShared`, `setShared`, `hasShared`, and `deleteShared`.
- Implemented `getAllShared` for initializing new Renderer windows with the complete shared cache state.
- Updated IPC communication to support bidirectional synchronization of shared cache between Main and Renderer processes.
- Enhanced cache management with absolute timestamps for TTL, ensuring precise expiration handling across windows.
- Added ready state tracking in Renderer for improved synchronization feedback during initialization.
- Refactored related documentation to reflect new features and usage patterns for shared cache.
2025-12-29 23:56:27 +08:00
..
api docs(data): update README and remove outdated API design guidelines 2025-12-29 17:15:06 +08:00
cache feat(cache): enhance shared cache functionality and synchronization in main 2025-12-29 23:56:27 +08:00
migration/v2 refactor: update migration types and imports for consistency 2025-11-20 22:42:43 +08:00
preference Merge 'main' into v2 2025-12-05 10:54:35 +08:00
types fix(api): enhance message status handling 2025-12-28 21:24:00 +08:00
README.md docs(data): update README and remove outdated API design guidelines 2025-12-29 17:15:06 +08:00

Shared Data Types

This directory contains shared type definitions for Cherry Studio's data layer.

Documentation

For comprehensive documentation, see:

Directory Structure

packages/shared/data/
├── api/                     # Data API type system
│   ├── index.ts             # Barrel exports
│   ├── apiTypes.ts          # Core request/response types
│   ├── apiPaths.ts          # Path template utilities
│   ├── apiErrors.ts         # Error handling
│   └── schemas/             # Domain-specific API schemas
├── cache/                   # Cache system type definitions
│   ├── cacheTypes.ts        # Core cache types
│   ├── cacheSchemas.ts      # Cache key schemas
│   └── cacheValueTypes.ts   # Cache value types
├── preference/              # Preference system type definitions
│   ├── preferenceTypes.ts   # Core preference types
│   └── preferenceSchemas.ts # Preference schemas
└── types/                   # Shared data types

Quick Reference

Import Conventions

// API infrastructure types (from barrel)
import type { DataRequest, DataResponse, ApiClient } from '@shared/data/api'
import { ErrorCode, DataApiError, DataApiErrorFactory } from '@shared/data/api'

// Domain DTOs (from schema files)
import type { Topic, CreateTopicDto } from '@shared/data/api/schemas/topic'

// Cache types
import type { UseCacheKey, UseSharedCacheKey } from '@shared/data/cache'

// Preference types
import type { PreferenceKeyType } from '@shared/data/preference'