refactor(utils): add barrel exports
This commit is contained in:
@@ -11,9 +11,9 @@ export * from "./fb_id_login_request";
|
||||
export * from "./google_login_request";
|
||||
export * from "./guest_login_request";
|
||||
export * from "./guest_login_response";
|
||||
export * from "./login_status";
|
||||
export * from "./login_request";
|
||||
export * from "./login_response";
|
||||
export * from "./login_status";
|
||||
export * from "./logout_response";
|
||||
export * from "./refresh_token_request";
|
||||
export * from "./refresh_token_response";
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
type GuestChatQuotaInput,
|
||||
type GuestChatQuotaData,
|
||||
} from "@/data/schemas/chat/guest_chat_quota";
|
||||
import { AppEnvUtil } from "@/utils/app-env";
|
||||
import { AppEnvUtil } from "@/utils";
|
||||
|
||||
export class GuestChatQuota {
|
||||
// 静态常量
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
SendCodeRequest,
|
||||
} from "@/data/dto/auth";
|
||||
import { User } from "@/data/dto/user";
|
||||
import { Result } from "@/utils/result";
|
||||
import { Result } from "@/utils";
|
||||
import type { IAuthRepository } from "@/data/repositories/interfaces";
|
||||
import { AuthStorage, type IAuthStorage } from "@/data/storage/auth";
|
||||
import { UserStorage, type IUserStorage } from "@/data/storage/user";
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
ChatSendResponse,
|
||||
SendMessageRequest,
|
||||
} from "@/data/dto/chat";
|
||||
import { Result } from "@/utils/result";
|
||||
import { Result } from "@/utils";
|
||||
import type { IChatRepository } from "@/data/repositories/interfaces";
|
||||
import { LocalChatStorage, LocalMessage } from "@/data/storage/chat";
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* 原始 Dart: lib/data/repositories/auth_repository_impl.dart
|
||||
*/
|
||||
|
||||
import type { Result } from "@/utils/result";
|
||||
import type { Result } from "@/utils";
|
||||
import type {
|
||||
GuestLoginResponse,
|
||||
LoginResponse,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* 原始 Dart: lib/data/repositories/chat_repository_impl.dart
|
||||
*/
|
||||
|
||||
import type { Result } from "@/utils/result";
|
||||
import type { Result } from "@/utils";
|
||||
import type {
|
||||
ChatHistoryResponse,
|
||||
ChatMessage,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* 原始 Dart: lib/data/repositories/metrics_repository_impl.dart
|
||||
*/
|
||||
|
||||
import type { Result } from "@/utils/result";
|
||||
import type { Result } from "@/utils";
|
||||
|
||||
export interface IMetricsRepository {
|
||||
/** 上报 PWA 事件。自动注入当前秒级时间戳。 */
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* 原始 Dart: lib/data/repositories/user_repository_impl.dart
|
||||
*/
|
||||
|
||||
import type { Result } from "@/utils/result";
|
||||
import type { Result } from "@/utils";
|
||||
import type {
|
||||
CreditsData,
|
||||
CreditsHistoryData,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
import { MetricsApi, metricsApi } from "@/data/services/api";
|
||||
import { AppEvent, PwaEvent } from "@/data/dto/metrics";
|
||||
import { Result } from "@/utils/result";
|
||||
import { Result } from "@/utils";
|
||||
import type { IMetricsRepository } from "@/data/repositories/interfaces";
|
||||
|
||||
export class MetricsRepository implements IMetricsRepository {
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
User,
|
||||
UserStatsResponse,
|
||||
} from "@/data/dto/user";
|
||||
import { Result } from "@/utils/result";
|
||||
import { Result } from "@/utils";
|
||||
import type { IUserRepository } from "@/data/repositories/interfaces";
|
||||
|
||||
export class UserRepository implements IUserRepository {
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
* - `recordXxx(today)` 写入 todayString,后续 `canXxx` 在同一天返回 `false`。
|
||||
*/
|
||||
|
||||
import { Result, type Result as ResultT } from "@/utils/result";
|
||||
import { SpAsyncUtil } from "@/utils/storage";
|
||||
import { Result, type Result as ResultT, SpAsyncUtil } from "@/utils";
|
||||
import { StorageKeys } from "../storage_keys";
|
||||
|
||||
export class AppStorage {
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
* - `clearAuthData` 顺序清理:loginToken → guestToken → refreshToken,任一失败立即返回
|
||||
*/
|
||||
|
||||
import { Result, type Result as ResultT } from "@/utils/result";
|
||||
import { SpAsyncUtil } from "@/utils/storage";
|
||||
import { Result, type Result as ResultT, SpAsyncUtil } from "@/utils";
|
||||
import { StorageKeys } from "../storage_keys";
|
||||
import type { IAuthStorage } from "./iauth_storage";
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* - 所有方法返回 `Promise<Result<T>>`,与 Dart `Future<Result<T>>` 对齐
|
||||
*/
|
||||
|
||||
import type { Result } from "@/utils/result";
|
||||
import type { Result } from "@/utils";
|
||||
|
||||
export interface IAuthStorage {
|
||||
getLoginToken(): Promise<Result<string | null>>;
|
||||
|
||||
@@ -4,8 +4,7 @@ import memoryDriver from "unstorage/drivers/memory";
|
||||
|
||||
import { GuestChatQuota } from "@/data/dto/chat/guest_chat_quota";
|
||||
import { StorageKeys } from "@/data/storage/storage_keys";
|
||||
import { todayString } from "@/utils/date";
|
||||
import { SpAsyncUtil } from "@/utils/storage";
|
||||
import { todayString, SpAsyncUtil } from "@/utils";
|
||||
|
||||
import { ChatStorage } from "../chat_storage";
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@ import {
|
||||
import { GuestChatQuota as GuestChatQuotaDto } from "@/data/dto/chat/guest_chat_quota";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type Result as ResultT, Result } from "@/utils/result";
|
||||
import { todayString } from "@/utils/date";
|
||||
import { SpAsyncUtil } from "@/utils/storage";
|
||||
import { type Result as ResultT, Result, todayString, SpAsyncUtil } from "@/utils";
|
||||
import { StorageKeys } from "../storage_keys";
|
||||
import type { IChatStorage } from "./ichat_storage";
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* 跨天判断逻辑(`needsReset`)保留在 `GuestChatQuota` 类上。
|
||||
*/
|
||||
|
||||
import type { Result } from "@/utils/result";
|
||||
import type { Result } from "@/utils";
|
||||
import type { GuestChatQuotaData } from "@/data/schemas/chat/guest_chat_quota";
|
||||
|
||||
export interface IChatStorage {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* 数据量大时考虑升级 schema 加索引。
|
||||
*/
|
||||
|
||||
import { Result, type Result as ResultT } from "@/utils/result";
|
||||
import { Result, type Result as ResultT } from "@/utils";
|
||||
import { LocalChatDB } from "./local_chat_db";
|
||||
import { LocalMessage } from "./local_message";
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* 具体序列化由实现层通过 Zod schema 校验后转换为 `User` 类实例。
|
||||
*/
|
||||
|
||||
import type { Result } from "@/utils/result";
|
||||
import type { Result } from "@/utils";
|
||||
import type { UserData } from "@/data/schemas/user/user";
|
||||
|
||||
export interface IUserStorage {
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
import { UserSchema, type UserData } from "@/data/schemas/user/user";
|
||||
import { type Result as ResultT } from "@/utils/result";
|
||||
import { SpAsyncUtil } from "@/utils/storage";
|
||||
import { type Result as ResultT, SpAsyncUtil } from "@/utils";
|
||||
import { StorageKeys } from "../storage_keys";
|
||||
import type { IUserStorage } from "./iuser_storage";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user