sa2kit 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{UniversalFileService-C1rUWWU-.d.ts → UniversalFileService-BuHN-jrR.d.ts} +46 -2
- package/dist/{UniversalFileService-DrCK0-NL.d.mts → UniversalFileService-CGGzYeeF.d.mts} +46 -2
- package/dist/{chunk-3XG5OHFD.mjs → chunk-CIVO4R6N.mjs} +2 -2
- package/dist/{chunk-3XG5OHFD.mjs.map → chunk-CIVO4R6N.mjs.map} +1 -1
- package/dist/chunk-EV6BCVOQ.mjs +204 -0
- package/dist/chunk-EV6BCVOQ.mjs.map +1 -0
- package/dist/chunk-W35VTQAW.js +211 -0
- package/dist/chunk-W35VTQAW.js.map +1 -0
- package/dist/{chunk-HWJ34NL6.js → chunk-ZRAW3HXA.js} +2 -2
- package/dist/{chunk-HWJ34NL6.js.map → chunk-ZRAW3HXA.js.map} +1 -1
- package/dist/drizzle-schema-BNhqj2AZ.d.mts +1114 -0
- package/dist/drizzle-schema-BNhqj2AZ.d.ts +1114 -0
- package/dist/mmd/admin/index.d.mts +8 -1115
- package/dist/mmd/admin/index.d.ts +8 -1115
- package/dist/mmd/admin/index.js +98 -248
- package/dist/mmd/admin/index.js.map +1 -1
- package/dist/mmd/admin/index.mjs +75 -244
- package/dist/mmd/admin/index.mjs.map +1 -1
- package/dist/mmd/index.d.mts +2 -2
- package/dist/mmd/index.d.ts +2 -2
- package/dist/mmd/server/index.d.mts +138 -0
- package/dist/mmd/server/index.d.ts +138 -0
- package/dist/mmd/server/index.js +245 -0
- package/dist/mmd/server/index.js.map +1 -0
- package/dist/mmd/server/index.mjs +207 -0
- package/dist/mmd/server/index.mjs.map +1 -0
- package/dist/testYourself/index.d.mts +145 -0
- package/dist/testYourself/index.d.ts +145 -0
- package/dist/testYourself/index.js +1004 -0
- package/dist/testYourself/index.js.map +1 -0
- package/dist/testYourself/index.mjs +993 -0
- package/dist/testYourself/index.mjs.map +1 -0
- package/dist/{types-C2ale3d9.d.mts → types-Bc_p-zAR.d.mts} +1 -1
- package/dist/{types-C2ale3d9.d.ts → types-Bc_p-zAR.d.ts} +1 -1
- package/dist/{types-Dg-U_chI.d.mts → types-CK4We_aI.d.mts} +13 -1
- package/dist/{types-Dg-U_chI.d.ts → types-CK4We_aI.d.ts} +13 -1
- package/dist/universalFile/index.d.mts +3 -3
- package/dist/universalFile/index.d.ts +3 -3
- package/dist/universalFile/index.js +48 -10
- package/dist/universalFile/index.js.map +1 -1
- package/dist/universalFile/index.mjs +43 -5
- package/dist/universalFile/index.mjs.map +1 -1
- package/dist/universalFile/server/index.d.mts +3 -3
- package/dist/universalFile/server/index.d.ts +3 -3
- package/dist/universalFile/server/index.js +239 -7
- package/dist/universalFile/server/index.js.map +1 -1
- package/dist/universalFile/server/index.mjs +234 -2
- package/dist/universalFile/server/index.mjs.map +1 -1
- package/package.json +14 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { S as StorageType$1, C as CDNType$1, F as FileMetadata, A as AccessPermission, U as UploadStatus, P as ProcessorType$1, a as UploadFileInfo$1, b as ProcessingOptions$1, c as UploadProgress, d as FileEventListener$1 } from './types-
|
|
2
|
+
import { S as StorageType$1, C as CDNType$1, F as FileMetadata, A as AccessPermission, U as UploadStatus, P as ProcessorType$1, a as UploadFileInfo$1, b as ProcessingOptions$1, c as UploadProgress, d as FileQueryOptions$1, e as PaginatedResult$1, B as BatchOperationResult, f as FileEventListener$1 } from './types-CK4We_aI.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* UniversalFile Server 端类型定义
|
|
@@ -440,6 +440,30 @@ declare class UniversalFileService extends EventEmitter {
|
|
|
440
440
|
* 上传文件
|
|
441
441
|
*/
|
|
442
442
|
uploadFile(fileInfo: UploadFileInfo$1, storageType?: StorageType$1, onProgress?: (progress: UploadProgress) => void): Promise<FileMetadata>;
|
|
443
|
+
/**
|
|
444
|
+
* 下载文件
|
|
445
|
+
*/
|
|
446
|
+
downloadFile(fileId: string, userId?: string): Promise<Buffer>;
|
|
447
|
+
/**
|
|
448
|
+
* 删除文件
|
|
449
|
+
*/
|
|
450
|
+
deleteFile(fileId: string, userId?: string): Promise<void>;
|
|
451
|
+
/**
|
|
452
|
+
* 获取文件访问URL
|
|
453
|
+
*/
|
|
454
|
+
getFileUrl(fileId: string, userId?: string, expiresIn?: number): Promise<string>;
|
|
455
|
+
/**
|
|
456
|
+
* 获取文件元数据
|
|
457
|
+
*/
|
|
458
|
+
getFileMetadata(fileId: string): Promise<FileMetadata | null>;
|
|
459
|
+
/**
|
|
460
|
+
* 查询文件列表
|
|
461
|
+
*/
|
|
462
|
+
queryFiles(options: FileQueryOptions$1): Promise<PaginatedResult$1<FileMetadata>>;
|
|
463
|
+
/**
|
|
464
|
+
* 批量删除文件
|
|
465
|
+
*/
|
|
466
|
+
batchDeleteFiles(fileIds: string[], userId?: string): Promise<BatchOperationResult>;
|
|
443
467
|
/**
|
|
444
468
|
* 获取上传进度
|
|
445
469
|
*/
|
|
@@ -464,8 +488,28 @@ declare class UniversalFileService extends EventEmitter {
|
|
|
464
488
|
private generateProcessedPath;
|
|
465
489
|
private processFileQueue;
|
|
466
490
|
private cacheMetadata;
|
|
467
|
-
private
|
|
491
|
+
private clearMetadataCache;
|
|
468
492
|
private emitFileEvent;
|
|
493
|
+
/**
|
|
494
|
+
* 保存文件元数据到数据库 (通过持久化仓储)
|
|
495
|
+
*/
|
|
496
|
+
private saveFileMetadata;
|
|
497
|
+
/**
|
|
498
|
+
* 从数据库删除文件元数据 (通过持久化仓储)
|
|
499
|
+
*/
|
|
500
|
+
private deleteFileMetadata;
|
|
501
|
+
/**
|
|
502
|
+
* 更新访问统计
|
|
503
|
+
*/
|
|
504
|
+
private updateAccessStats;
|
|
505
|
+
/**
|
|
506
|
+
* 检查文件访问权限
|
|
507
|
+
*/
|
|
508
|
+
private checkFileAccess;
|
|
509
|
+
/**
|
|
510
|
+
* 检查文件删除权限
|
|
511
|
+
*/
|
|
512
|
+
private checkFileDeleteAccess;
|
|
469
513
|
}
|
|
470
514
|
|
|
471
515
|
export { type AliyunOSSConfig as A, CDNProviderError as B, type CDNType as C, type FileServicePersistenceConfig as F, type IStorageProvider as I, type LocalStorageConfig as L, type ProcessorType as P, type StorageConfig as S, UniversalFileService as U, type UniversalFileServiceConfig as a, type StorageType as b, type UploadFileInfo as c, type StorageResult as d, type ICDNProvider as e, type CDNConfig as f, type CDNResult as g, type IFileProcessor as h, type ProcessingOptions as i, type ProcessingResult as j, type IFileMetadataRepository as k, type AliyunCDNConfig as l, type CacheConfig as m, type StorageMetadata as n, type CDNStats as o, type ProcessorInfo as p, type FileRecord as q, type FileQueryOptions as r, type PaginatedResult as s, type FileEvent as t, type FileEventListener as u, type FileEventType as v, FileServiceError as w, FileUploadError as x, FileProcessingError as y, StorageProviderError as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { S as StorageType$1, C as CDNType$1, F as FileMetadata, A as AccessPermission, U as UploadStatus, P as ProcessorType$1, a as UploadFileInfo$1, b as ProcessingOptions$1, c as UploadProgress, d as FileEventListener$1 } from './types-
|
|
2
|
+
import { S as StorageType$1, C as CDNType$1, F as FileMetadata, A as AccessPermission, U as UploadStatus, P as ProcessorType$1, a as UploadFileInfo$1, b as ProcessingOptions$1, c as UploadProgress, d as FileQueryOptions$1, e as PaginatedResult$1, B as BatchOperationResult, f as FileEventListener$1 } from './types-CK4We_aI.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* UniversalFile Server 端类型定义
|
|
@@ -440,6 +440,30 @@ declare class UniversalFileService extends EventEmitter {
|
|
|
440
440
|
* 上传文件
|
|
441
441
|
*/
|
|
442
442
|
uploadFile(fileInfo: UploadFileInfo$1, storageType?: StorageType$1, onProgress?: (progress: UploadProgress) => void): Promise<FileMetadata>;
|
|
443
|
+
/**
|
|
444
|
+
* 下载文件
|
|
445
|
+
*/
|
|
446
|
+
downloadFile(fileId: string, userId?: string): Promise<Buffer>;
|
|
447
|
+
/**
|
|
448
|
+
* 删除文件
|
|
449
|
+
*/
|
|
450
|
+
deleteFile(fileId: string, userId?: string): Promise<void>;
|
|
451
|
+
/**
|
|
452
|
+
* 获取文件访问URL
|
|
453
|
+
*/
|
|
454
|
+
getFileUrl(fileId: string, userId?: string, expiresIn?: number): Promise<string>;
|
|
455
|
+
/**
|
|
456
|
+
* 获取文件元数据
|
|
457
|
+
*/
|
|
458
|
+
getFileMetadata(fileId: string): Promise<FileMetadata | null>;
|
|
459
|
+
/**
|
|
460
|
+
* 查询文件列表
|
|
461
|
+
*/
|
|
462
|
+
queryFiles(options: FileQueryOptions$1): Promise<PaginatedResult$1<FileMetadata>>;
|
|
463
|
+
/**
|
|
464
|
+
* 批量删除文件
|
|
465
|
+
*/
|
|
466
|
+
batchDeleteFiles(fileIds: string[], userId?: string): Promise<BatchOperationResult>;
|
|
443
467
|
/**
|
|
444
468
|
* 获取上传进度
|
|
445
469
|
*/
|
|
@@ -464,8 +488,28 @@ declare class UniversalFileService extends EventEmitter {
|
|
|
464
488
|
private generateProcessedPath;
|
|
465
489
|
private processFileQueue;
|
|
466
490
|
private cacheMetadata;
|
|
467
|
-
private
|
|
491
|
+
private clearMetadataCache;
|
|
468
492
|
private emitFileEvent;
|
|
493
|
+
/**
|
|
494
|
+
* 保存文件元数据到数据库 (通过持久化仓储)
|
|
495
|
+
*/
|
|
496
|
+
private saveFileMetadata;
|
|
497
|
+
/**
|
|
498
|
+
* 从数据库删除文件元数据 (通过持久化仓储)
|
|
499
|
+
*/
|
|
500
|
+
private deleteFileMetadata;
|
|
501
|
+
/**
|
|
502
|
+
* 更新访问统计
|
|
503
|
+
*/
|
|
504
|
+
private updateAccessStats;
|
|
505
|
+
/**
|
|
506
|
+
* 检查文件访问权限
|
|
507
|
+
*/
|
|
508
|
+
private checkFileAccess;
|
|
509
|
+
/**
|
|
510
|
+
* 检查文件删除权限
|
|
511
|
+
*/
|
|
512
|
+
private checkFileDeleteAccess;
|
|
469
513
|
}
|
|
470
514
|
|
|
471
515
|
export { type AliyunOSSConfig as A, CDNProviderError as B, type CDNType as C, type FileServicePersistenceConfig as F, type IStorageProvider as I, type LocalStorageConfig as L, type ProcessorType as P, type StorageConfig as S, UniversalFileService as U, type UniversalFileServiceConfig as a, type StorageType as b, type UploadFileInfo as c, type StorageResult as d, type ICDNProvider as e, type CDNConfig as f, type CDNResult as g, type IFileProcessor as h, type ProcessingOptions as i, type ProcessingResult as j, type IFileMetadataRepository as k, type AliyunCDNConfig as l, type CacheConfig as m, type StorageMetadata as n, type CDNStats as o, type ProcessorInfo as p, type FileRecord as q, type FileQueryOptions as r, type PaginatedResult as s, type FileEvent as t, type FileEventListener as u, type FileEventType as v, FileServiceError as w, FileUploadError as x, FileProcessingError as y, StorageProviderError as z };
|
|
@@ -33,5 +33,5 @@ var CDNProviderError = class extends FileServiceError {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
export { CDNProviderError, FileProcessingError, FileServiceError, FileUploadError, StorageProviderError };
|
|
36
|
-
//# sourceMappingURL=chunk-
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
36
|
+
//# sourceMappingURL=chunk-CIVO4R6N.mjs.map
|
|
37
|
+
//# sourceMappingURL=chunk-CIVO4R6N.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/universalFile/types.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/universalFile/types.ts"],"names":[],"mappings":";AAmSO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EAC1C,WAAA,CACE,OAAA,EACgB,IAAA,EACA,OAAA,EAChB;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAHG,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AACA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAGhB,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,EACd;AACF;AAGO,IAAM,eAAA,GAAN,cAA8B,gBAAA,CAAiB;AAAA,EACpD,WAAA,CAAY,SAAiB,OAAA,EAA+B;AAC1D,IAAA,KAAA,CAAM,OAAA,EAAS,qBAAqB,OAAO,CAAA;AAC3C,IAAA,IAAA,CAAK,IAAA,GAAO,iBAAA;AAAA,EACd;AACF;AAGO,IAAM,mBAAA,GAAN,cAAkC,gBAAA,CAAiB;AAAA,EACxD,WAAA,CAAY,SAAiB,OAAA,EAA+B;AAC1D,IAAA,KAAA,CAAM,OAAA,EAAS,yBAAyB,OAAO,CAAA;AAC/C,IAAA,IAAA,CAAK,IAAA,GAAO,qBAAA;AAAA,EACd;AACF;AAGO,IAAM,oBAAA,GAAN,cAAmC,gBAAA,CAAiB;AAAA,EACzD,WAAA,CAAY,SAAiB,OAAA,EAA+B;AAC1D,IAAA,KAAA,CAAM,OAAA,EAAS,0BAA0B,OAAO,CAAA;AAChD,IAAA,IAAA,CAAK,IAAA,GAAO,sBAAA;AAAA,EACd;AACF;AAGO,IAAM,gBAAA,GAAN,cAA+B,gBAAA,CAAiB;AAAA,EACrD,WAAA,CAAY,SAAiB,OAAA,EAA+B;AAC1D,IAAA,KAAA,CAAM,OAAA,EAAS,sBAAsB,OAAO,CAAA;AAC5C,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,EACd;AACF","file":"chunk-CIVO4R6N.mjs","sourcesContent":["/**\n * 通用文件服务类型定义\n *\n * 定义了文件存储、上传、下载等核心接口和类型\n */\n\n// ============= 基础类型定义 =============\n\n/** 文件存储类型 */\nexport type StorageType = 'local' | 'aliyun-oss' | 'aws-s3' | 'qcloud-cos';\n\n/** CDN提供者类型 */\nexport type CDNType = 'none' | 'aliyun-cdn' | 'aws-cloudfront' | 'qcloud-cdn';\n\n/** 文件处理类型 */\nexport type ProcessorType = 'image' | 'audio' | 'video' | 'document';\n\n/** 文件上传状态 */\nexport type UploadStatus = 'pending' | 'uploading' | 'processing' | 'completed' | 'failed';\n\n/** 访问权限类型 */\nexport type AccessPermission = 'public' | 'private' | 'authenticated' | 'owner-only';\n\n// ============= 文件元数据接口 =============\n\n/** 文件元数据基础接口 */\nexport interface FileMetadata {\n /** 文件ID */\n id: string;\n /** 原始文件名 */\n originalName: string;\n /** 存储文件名 */\n storageName: string;\n /** 文件大小(字节) */\n size: number;\n /** MIME类型 */\n mimeType: string;\n /** 文件扩展名 */\n extension: string;\n /** 文件哈希值 */\n hash?: string;\n /** 上传时间 */\n uploadTime: Date;\n /** 访问权限 */\n permission: AccessPermission;\n /** 上传者ID */\n uploaderId: string;\n /** 模块标识 */\n moduleId: string;\n /** 业务标识 */\n businessId?: string;\n /** 存储提供者 */\n storageProvider: StorageType;\n /** 存储路径 */\n storagePath: string;\n /** CDN URL */\n cdnUrl?: string;\n /** 访问次数 */\n accessCount: number;\n /** 最后访问时间 */\n lastAccessTime?: Date;\n /** 过期时间 */\n expiresAt?: Date;\n /** 自定义元数据 */\n metadata?: Record<string, any>;\n}\n\n/** 上传文件信息(客户端使用) */\nexport interface UploadFileInfo {\n /** 文件对象 */\n file: File;\n /** 模块标识 */\n moduleId: string;\n /** 业务标识 */\n businessId?: string;\n /** 访问权限 */\n permission?: AccessPermission;\n /** 自定义存储路径 */\n customPath?: string;\n /** 自定义元数据 */\n metadata?: Record<string, any>;\n /** 是否需要处理 */\n needsProcessing?: boolean;\n /** 处理选项 */\n processingOptions?: ProcessingOptions;\n}\n\n/** 文件处理选项基础接口 */\nexport interface ProcessingOptions {\n /** 处理器类型 */\n type: ProcessorType;\n /** 处理参数 */\n params?: Record<string, any>;\n}\n\n/** 图片处理选项 */\nexport interface ImageProcessingOptions extends ProcessingOptions {\n type: 'image';\n /** 压缩质量 0-100 */\n quality?: number;\n /** 目标宽度 */\n width?: number;\n /** 目标高度 */\n height?: number;\n /** 格式转换 */\n format?: 'jpeg' | 'png' | 'webp' | 'avif';\n /** 是否添加水印 */\n watermark?: boolean;\n /** 水印配置 */\n watermarkOptions?: {\n text?: string;\n image?: string;\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';\n opacity?: number;\n };\n}\n\n/** 音频处理选项 */\nexport interface AudioProcessingOptions extends ProcessingOptions {\n type: 'audio';\n /** 比特率 */\n bitrate?: number;\n /** 格式转换 */\n format?: 'mp3' | 'wav' | 'ogg' | 'aac';\n /** 采样率 */\n sampleRate?: number;\n /** 声道数 */\n channels?: number;\n}\n\n/** 视频处理选项 */\nexport interface VideoProcessingOptions extends ProcessingOptions {\n type: 'video';\n /** 视频质量 */\n quality?: number;\n /** 格式转换 */\n format?: 'mp4' | 'avi' | 'mov' | 'webm';\n /** 生成缩略图 */\n generateThumbnail?: boolean;\n /** 缩略图时间点(秒) */\n thumbnailTime?: number;\n}\n\n// ============= 上传相关接口 =============\n\n/** 上传进度 */\nexport interface UploadProgress {\n /** 文件ID */\n fileId: string;\n /** 上传状态 */\n status: UploadStatus;\n /** 进度百分比(0-100) */\n progress: number;\n /** 已上传字节数 */\n uploadedBytes: number;\n /** 总字节数 */\n totalBytes: number;\n /** 上传速度(字节/秒) */\n speed: number;\n /** 剩余时间(秒) */\n remainingTime: number;\n /** 错误信息 */\n error?: string;\n}\n\n/** 上传结果 */\nexport interface UploadResult {\n /** 是否成功 */\n success: boolean;\n /** 文件元数据 */\n file?: FileMetadata;\n /** 文件访问URL */\n url?: string;\n /** 错误信息 */\n error?: string;\n}\n\n/** 批量操作结果 */\nexport interface BatchOperationResult {\n /** 成功数量 */\n successCount: number;\n /** 失败数量 */\n failureCount: number;\n /** 失败详情 */\n failures: Array<{\n fileId: string;\n error: string;\n }>;\n}\n\n// ============= 查询相关接口 =============\n\n/** 文件查询选项 */\nexport interface FileQueryOptions {\n /** 模块标识 */\n moduleId?: string;\n /** 业务标识 */\n businessId?: string;\n /** 上传者ID */\n uploaderId?: string;\n /** MIME类型过滤 */\n mimeType?: string;\n /** 最小文件大小 */\n minSize?: number;\n /** 最大文件大小 */\n maxSize?: number;\n /** 开始时间 */\n startTime?: Date;\n /** 结束时间 */\n endTime?: Date;\n /** 搜索关键词 */\n keyword?: string;\n /** 标签 */\n tags?: string[];\n /** 排序字段 */\n sortBy?: string;\n /** 排序方向 */\n sortOrder?: 'asc' | 'desc';\n /** 页码 */\n page?: number;\n /** 每页数量 */\n pageSize?: number;\n}\n\n/** 分页结果 */\nexport interface PaginatedResult<T> {\n /** 数据项 */\n items: T[];\n /** 总数 */\n total: number;\n /** 当前页码 */\n page: number;\n /** 每页数量 */\n pageSize: number;\n /** 总页数 */\n totalPages: number;\n /** 是否有下一页 */\n hasNext: boolean;\n /** 是否有上一页 */\n hasPrev: boolean;\n}\n\n/** 批量操作结果 */\nexport interface BatchOperationResult {\n /** 成功数量 */\n successCount: number;\n /** 失败数量 */\n failureCount: number;\n /** 失败详情 */\n failures: Array<{\n fileId: string;\n error: string;\n }>;\n}\n\n// ============= 事件相关接口 =============\n\n/** 文件事件类型 */\nexport type FileEventType =\n | 'upload:start'\n | 'upload:progress'\n | 'upload:complete'\n | 'upload:error'\n | 'download:start'\n | 'download:complete'\n | 'download:error'\n | 'delete:complete'\n | 'processing:start'\n | 'processing:complete'\n | 'processing:error';\n\n/** 文件事件 */\nexport interface FileEvent {\n /** 事件类型 */\n type: FileEventType;\n /** 文件ID */\n fileId: string;\n /** 事件时间 */\n timestamp: Date;\n /** 事件数据 */\n data?: Record<string, any>;\n /** 错误信息 */\n error?: string;\n}\n\n/** 文件事件监听器 */\nexport type FileEventListener = (event: FileEvent) => void | Promise<void>;\n\n// ============= 异常类定义 =============\n\n/** 文件服务基础异常 */\nexport class FileServiceError extends Error {\n constructor(\n message: string,\n public readonly code: string,\n public readonly details?: Record<string, any>\n ) {\n super(message);\n this.name = 'FileServiceError';\n }\n}\n\n/** 文件上传错误 */\nexport class FileUploadError extends FileServiceError {\n constructor(message: string, details?: Record<string, any>) {\n super(message, 'FILE_UPLOAD_ERROR', details);\n this.name = 'FileUploadError';\n }\n}\n\n/** 文件处理错误 */\nexport class FileProcessingError extends FileServiceError {\n constructor(message: string, details?: Record<string, any>) {\n super(message, 'FILE_PROCESSING_ERROR', details);\n this.name = 'FileProcessingError';\n }\n}\n\n/** 存储提供者错误 */\nexport class StorageProviderError extends FileServiceError {\n constructor(message: string, details?: Record<string, any>) {\n super(message, 'STORAGE_PROVIDER_ERROR', details);\n this.name = 'StorageProviderError';\n }\n}\n\n/** CDN提供者错误 */\nexport class CDNProviderError extends FileServiceError {\n constructor(message: string, details?: Record<string, any>) {\n super(message, 'CDN_PROVIDER_ERROR', details);\n this.name = 'CDNProviderError';\n }\n}\n\n"]}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { relations } from 'drizzle-orm';
|
|
2
|
+
import { pgTable, timestamp, varchar, json, integer, uuid, boolean, text, index } from 'drizzle-orm/pg-core';
|
|
3
|
+
|
|
4
|
+
// src/mmd/server/drizzle-schema.ts
|
|
5
|
+
var mmdPlaylists = pgTable(
|
|
6
|
+
"mmd_playlists",
|
|
7
|
+
{
|
|
8
|
+
/** 主键ID */
|
|
9
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
10
|
+
/** 播放列表名称 */
|
|
11
|
+
name: varchar("name", { length: 255 }).notNull(),
|
|
12
|
+
/** 播放列表描述 */
|
|
13
|
+
description: text("description"),
|
|
14
|
+
/** 是否启用列表循环 */
|
|
15
|
+
loop: boolean("loop").notNull().default(false),
|
|
16
|
+
/** 预加载策略: none, next, all */
|
|
17
|
+
preloadStrategy: varchar("preload_strategy", { length: 20 }).notNull().default("none"),
|
|
18
|
+
/** 是否自动播放 */
|
|
19
|
+
autoPlay: boolean("auto_play").notNull().default(false),
|
|
20
|
+
/** 播放列表缩略图文件ID (关联 file_metadata.id) */
|
|
21
|
+
thumbnailFileId: uuid("thumbnail_file_id"),
|
|
22
|
+
/** 播放列表状态: draft, published, archived */
|
|
23
|
+
status: varchar("status", { length: 20 }).notNull().default("draft"),
|
|
24
|
+
/** 显示顺序 */
|
|
25
|
+
sortOrder: integer("sort_order").notNull().default(0),
|
|
26
|
+
/** 额外配置(JSON格式,存储舞台配置等) */
|
|
27
|
+
config: json("config"),
|
|
28
|
+
/** 创建者ID */
|
|
29
|
+
createdBy: varchar("created_by", { length: 255 }).notNull(),
|
|
30
|
+
/** 创建时间 */
|
|
31
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
32
|
+
/** 更新时间 */
|
|
33
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull(),
|
|
34
|
+
/** 删除时间(软删除) */
|
|
35
|
+
deletedAt: timestamp("deleted_at")
|
|
36
|
+
},
|
|
37
|
+
(table) => ({
|
|
38
|
+
/** 按状态查询的索引 */
|
|
39
|
+
statusIndex: index("mmd_playlists_status_idx").on(table.status),
|
|
40
|
+
/** 按创建者查询的索引 */
|
|
41
|
+
createdByIndex: index("mmd_playlists_created_by_idx").on(table.createdBy),
|
|
42
|
+
/** 按删除状态查询的索引 */
|
|
43
|
+
deletedAtIndex: index("mmd_playlists_deleted_at_idx").on(table.deletedAt),
|
|
44
|
+
/** 按排序查询的索引 */
|
|
45
|
+
sortOrderIndex: index("mmd_playlists_sort_order_idx").on(table.sortOrder)
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
var mmdPlaylistNodes = pgTable(
|
|
49
|
+
"mmd_playlist_nodes",
|
|
50
|
+
{
|
|
51
|
+
/** 主键ID */
|
|
52
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
53
|
+
/** 所属播放列表ID */
|
|
54
|
+
playlistId: uuid("playlist_id").references(() => mmdPlaylists.id, { onDelete: "cascade" }).notNull(),
|
|
55
|
+
/** 节点名称 */
|
|
56
|
+
name: varchar("name", { length: 255 }).notNull(),
|
|
57
|
+
/** 节点描述 */
|
|
58
|
+
description: text("description"),
|
|
59
|
+
/** 是否启用节点循环 */
|
|
60
|
+
loop: boolean("loop").notNull().default(false),
|
|
61
|
+
/** 预计时长(秒) */
|
|
62
|
+
duration: integer("duration"),
|
|
63
|
+
/** 节点缩略图文件ID */
|
|
64
|
+
thumbnailFileId: uuid("thumbnail_file_id"),
|
|
65
|
+
/** 显示顺序 */
|
|
66
|
+
sortOrder: integer("sort_order").notNull().default(0),
|
|
67
|
+
/** 模型文件ID (关联 file_metadata.id) */
|
|
68
|
+
modelFileId: uuid("model_file_id").notNull(),
|
|
69
|
+
/** 动作文件ID */
|
|
70
|
+
motionFileId: uuid("motion_file_id"),
|
|
71
|
+
/** 相机动画文件ID */
|
|
72
|
+
cameraFileId: uuid("camera_file_id"),
|
|
73
|
+
/** 音频文件ID */
|
|
74
|
+
audioFileId: uuid("audio_file_id"),
|
|
75
|
+
/** 舞台模型文件ID */
|
|
76
|
+
stageModelFileId: uuid("stage_model_file_id"),
|
|
77
|
+
/** 附加动作文件ID列表(JSON数组) */
|
|
78
|
+
additionalMotionFileIds: json("additional_motion_file_ids").$type(),
|
|
79
|
+
/** 额外配置(JSON格式) */
|
|
80
|
+
config: json("config"),
|
|
81
|
+
/** 创建时间 */
|
|
82
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
83
|
+
/** 更新时间 */
|
|
84
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
85
|
+
},
|
|
86
|
+
(table) => ({
|
|
87
|
+
/** 按播放列表查询的索引 */
|
|
88
|
+
playlistIndex: index("mmd_playlist_nodes_playlist_idx").on(table.playlistId),
|
|
89
|
+
/** 按排序查询的索引 */
|
|
90
|
+
sortOrderIndex: index("mmd_playlist_nodes_sort_order_idx").on(table.sortOrder),
|
|
91
|
+
/** 按模型文件查询的索引 */
|
|
92
|
+
modelFileIndex: index("mmd_playlist_nodes_model_file_idx").on(table.modelFileId),
|
|
93
|
+
/** 组合索引:播放列表+排序 */
|
|
94
|
+
playlistSortIndex: index("mmd_playlist_nodes_playlist_sort_idx").on(
|
|
95
|
+
table.playlistId,
|
|
96
|
+
table.sortOrder
|
|
97
|
+
)
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
var mmdResourceOptions = pgTable(
|
|
101
|
+
"mmd_resource_options",
|
|
102
|
+
{
|
|
103
|
+
/** 主键ID */
|
|
104
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
105
|
+
/** 资源名称 */
|
|
106
|
+
name: varchar("name", { length: 255 }).notNull(),
|
|
107
|
+
/** 资源描述 */
|
|
108
|
+
description: text("description"),
|
|
109
|
+
/** 资源类型: model, motion, camera, audio, stage */
|
|
110
|
+
resourceType: varchar("resource_type", { length: 20 }).notNull(),
|
|
111
|
+
/** 文件ID (关联 file_metadata.id) */
|
|
112
|
+
fileId: uuid("file_id").notNull(),
|
|
113
|
+
/** 缩略图文件ID */
|
|
114
|
+
thumbnailFileId: uuid("thumbnail_file_id"),
|
|
115
|
+
/** 资源标签(JSON数组,用于分类和筛选) */
|
|
116
|
+
tags: json("tags").$type(),
|
|
117
|
+
/** 显示顺序 */
|
|
118
|
+
sortOrder: integer("sort_order").notNull().default(0),
|
|
119
|
+
/** 是否启用 */
|
|
120
|
+
isActive: boolean("is_active").notNull().default(true),
|
|
121
|
+
/** 创建者ID */
|
|
122
|
+
createdBy: varchar("created_by", { length: 255 }).notNull(),
|
|
123
|
+
/** 创建时间 */
|
|
124
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
125
|
+
/** 更新时间 */
|
|
126
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
127
|
+
},
|
|
128
|
+
(table) => ({
|
|
129
|
+
/** 按资源类型查询的索引 */
|
|
130
|
+
resourceTypeIndex: index("mmd_resource_options_resource_type_idx").on(table.resourceType),
|
|
131
|
+
/** 按文件ID查询的索引 */
|
|
132
|
+
fileIdIndex: index("mmd_resource_options_file_id_idx").on(table.fileId),
|
|
133
|
+
/** 按活跃状态查询的索引 */
|
|
134
|
+
isActiveIndex: index("mmd_resource_options_is_active_idx").on(table.isActive),
|
|
135
|
+
/** 按创建者查询的索引 */
|
|
136
|
+
createdByIndex: index("mmd_resource_options_created_by_idx").on(table.createdBy),
|
|
137
|
+
/** 组合索引:资源类型+活跃状态+排序 */
|
|
138
|
+
typeActiveSortIndex: index("mmd_resource_options_type_active_sort_idx").on(
|
|
139
|
+
table.resourceType,
|
|
140
|
+
table.isActive,
|
|
141
|
+
table.sortOrder
|
|
142
|
+
)
|
|
143
|
+
})
|
|
144
|
+
);
|
|
145
|
+
var mmdPresetItems = pgTable(
|
|
146
|
+
"mmd_preset_items",
|
|
147
|
+
{
|
|
148
|
+
/** 主键ID */
|
|
149
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
150
|
+
/** 预设名称 */
|
|
151
|
+
name: varchar("name", { length: 255 }).notNull(),
|
|
152
|
+
/** 预设描述 */
|
|
153
|
+
description: text("description"),
|
|
154
|
+
/** 缩略图文件ID */
|
|
155
|
+
thumbnailFileId: uuid("thumbnail_file_id"),
|
|
156
|
+
/** 模型文件ID */
|
|
157
|
+
modelFileId: uuid("model_file_id").notNull(),
|
|
158
|
+
/** 动作文件ID */
|
|
159
|
+
motionFileId: uuid("motion_file_id"),
|
|
160
|
+
/** 相机动画文件ID */
|
|
161
|
+
cameraFileId: uuid("camera_file_id"),
|
|
162
|
+
/** 音频文件ID */
|
|
163
|
+
audioFileId: uuid("audio_file_id"),
|
|
164
|
+
/** 舞台模型文件ID */
|
|
165
|
+
stageModelFileId: uuid("stage_model_file_id"),
|
|
166
|
+
/** 附加动作文件ID列表(JSON数组) */
|
|
167
|
+
additionalMotionFileIds: json("additional_motion_file_ids").$type(),
|
|
168
|
+
/** 显示顺序 */
|
|
169
|
+
sortOrder: integer("sort_order").notNull().default(0),
|
|
170
|
+
/** 是否启用 */
|
|
171
|
+
isActive: boolean("is_active").notNull().default(true),
|
|
172
|
+
/** 预设标签(JSON数组) */
|
|
173
|
+
tags: json("tags").$type(),
|
|
174
|
+
/** 创建者ID */
|
|
175
|
+
createdBy: varchar("created_by", { length: 255 }).notNull(),
|
|
176
|
+
/** 创建时间 */
|
|
177
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
178
|
+
/** 更新时间 */
|
|
179
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
180
|
+
},
|
|
181
|
+
(table) => ({
|
|
182
|
+
/** 按活跃状态查询的索引 */
|
|
183
|
+
isActiveIndex: index("mmd_preset_items_is_active_idx").on(table.isActive),
|
|
184
|
+
/** 按排序查询的索引 */
|
|
185
|
+
sortOrderIndex: index("mmd_preset_items_sort_order_idx").on(table.sortOrder),
|
|
186
|
+
/** 按创建者查询的索引 */
|
|
187
|
+
createdByIndex: index("mmd_preset_items_created_by_idx").on(table.createdBy),
|
|
188
|
+
/** 按模型文件查询的索引 */
|
|
189
|
+
modelFileIndex: index("mmd_preset_items_model_file_idx").on(table.modelFileId)
|
|
190
|
+
})
|
|
191
|
+
);
|
|
192
|
+
var mmdPlaylistsRelations = relations(mmdPlaylists, ({ many }) => ({
|
|
193
|
+
nodes: many(mmdPlaylistNodes)
|
|
194
|
+
}));
|
|
195
|
+
var mmdPlaylistNodesRelations = relations(mmdPlaylistNodes, ({ one }) => ({
|
|
196
|
+
playlist: one(mmdPlaylists, {
|
|
197
|
+
fields: [mmdPlaylistNodes.playlistId],
|
|
198
|
+
references: [mmdPlaylists.id]
|
|
199
|
+
})
|
|
200
|
+
}));
|
|
201
|
+
|
|
202
|
+
export { mmdPlaylistNodes, mmdPlaylistNodesRelations, mmdPlaylists, mmdPlaylistsRelations, mmdPresetItems, mmdResourceOptions };
|
|
203
|
+
//# sourceMappingURL=chunk-EV6BCVOQ.mjs.map
|
|
204
|
+
//# sourceMappingURL=chunk-EV6BCVOQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mmd/server/drizzle-schema.ts"],"names":[],"mappings":";;;;AAoCO,IAAM,YAAA,GAAe,OAAA;AAAA,EAC1B,eAAA;AAAA,EACA;AAAA;AAAA,IAEE,IAAI,IAAA,CAAK,IAAI,CAA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,CAAM,gCAAgC,CAAA,CAAE,EAAA,CAAG,MAAM,QAAQ,CAAA;AAAA;AAAA,IAGxE,gBAAgB,KAAA,CAAM,iCAAiC,CAAA,CAAE,EAAA,CAAG,MAAM,SAAS,CAAA;AAAA;AAAA,IAG3E,gBAAgB,KAAA,CAAM,iCAAiC,CAAA,CAAE,EAAA,CAAG,MAAM,SAAS,CAAA;AAAA;AAAA,IAG3E,gBAAgB,KAAA,CAAM,iCAAiC,CAAA,CAAE,EAAA,CAAG,MAAM,WAAW;AAAA,GAC/E;AACF;AAIO,IAAM,wBAAwB,SAAA,CAAU,YAAA,EAAc,CAAC,EAAE,MAAK,MAAO;AAAA,EAC1E,KAAA,EAAO,KAAK,gBAAgB;AAC9B,CAAA,CAAE;AAEK,IAAM,4BAA4B,SAAA,CAAU,gBAAA,EAAkB,CAAC,EAAE,KAAI,MAAO;AAAA,EACjF,QAAA,EAAU,IAAI,YAAA,EAAc;AAAA,IAC1B,MAAA,EAAQ,CAAC,gBAAA,CAAiB,UAAU,CAAA;AAAA,IACpC,UAAA,EAAY,CAAC,YAAA,CAAa,EAAE;AAAA,GAC7B;AACH,CAAA,CAAE","file":"chunk-EV6BCVOQ.mjs","sourcesContent":["/**\n * MMD 后台管理数据库表结构定义 (PostgreSQL)\n * \n * 功能:\n * - 管理MMD播放列表配置\n * - 管理MMD播放节点\n * - 文件关联管理(与 universalFile 集成)\n * - 支持多种资源类型的映射\n * \n * 设计原则:\n * - 与 universalFile 的 file_metadata 表无缝集成\n * - 支持文件ID到OSS URL的映射\n * - 保持数据结构灵活性,便于扩展\n * \n * @package sa2kit/mmd/server\n */\n\nimport { relations } from 'drizzle-orm';\nimport {\n serial,\n text,\n timestamp,\n pgTable,\n json,\n integer,\n boolean,\n varchar,\n index,\n uuid,\n} from 'drizzle-orm/pg-core';\n\n/**\n * MMD播放列表表 (mmd_playlists)\n * \n * 管理MMD播放列表的基础信息\n */\nexport const mmdPlaylists = pgTable(\n 'mmd_playlists',\n {\n /** 主键ID */\n id: uuid('id').primaryKey().defaultRandom(),\n\n /** 播放列表名称 */\n name: varchar('name', { length: 255 }).notNull(),\n\n /** 播放列表描述 */\n description: text('description'),\n\n /** 是否启用列表循环 */\n loop: boolean('loop').notNull().default(false),\n\n /** 预加载策略: none, next, all */\n preloadStrategy: varchar('preload_strategy', { length: 20 }).notNull().default('none'),\n\n /** 是否自动播放 */\n autoPlay: boolean('auto_play').notNull().default(false),\n\n /** 播放列表缩略图文件ID (关联 file_metadata.id) */\n thumbnailFileId: uuid('thumbnail_file_id'),\n\n /** 播放列表状态: draft, published, archived */\n status: varchar('status', { length: 20 }).notNull().default('draft'),\n\n /** 显示顺序 */\n sortOrder: integer('sort_order').notNull().default(0),\n\n /** 额外配置(JSON格式,存储舞台配置等) */\n config: json('config'),\n\n /** 创建者ID */\n createdBy: varchar('created_by', { length: 255 }).notNull(),\n\n /** 创建时间 */\n createdAt: timestamp('created_at').defaultNow().notNull(),\n\n /** 更新时间 */\n updatedAt: timestamp('updated_at').defaultNow().notNull(),\n\n /** 删除时间(软删除) */\n deletedAt: timestamp('deleted_at'),\n },\n (table) => ({\n /** 按状态查询的索引 */\n statusIndex: index('mmd_playlists_status_idx').on(table.status),\n\n /** 按创建者查询的索引 */\n createdByIndex: index('mmd_playlists_created_by_idx').on(table.createdBy),\n\n /** 按删除状态查询的索引 */\n deletedAtIndex: index('mmd_playlists_deleted_at_idx').on(table.deletedAt),\n\n /** 按排序查询的索引 */\n sortOrderIndex: index('mmd_playlists_sort_order_idx').on(table.sortOrder),\n })\n);\n\n/**\n * MMD播放节点表 (mmd_playlist_nodes)\n * \n * 管理播放列表中的每个播放节点\n */\nexport const mmdPlaylistNodes = pgTable(\n 'mmd_playlist_nodes',\n {\n /** 主键ID */\n id: uuid('id').primaryKey().defaultRandom(),\n\n /** 所属播放列表ID */\n playlistId: uuid('playlist_id')\n .references(() => mmdPlaylists.id, { onDelete: 'cascade' })\n .notNull(),\n\n /** 节点名称 */\n name: varchar('name', { length: 255 }).notNull(),\n\n /** 节点描述 */\n description: text('description'),\n\n /** 是否启用节点循环 */\n loop: boolean('loop').notNull().default(false),\n\n /** 预计时长(秒) */\n duration: integer('duration'),\n\n /** 节点缩略图文件ID */\n thumbnailFileId: uuid('thumbnail_file_id'),\n\n /** 显示顺序 */\n sortOrder: integer('sort_order').notNull().default(0),\n\n /** 模型文件ID (关联 file_metadata.id) */\n modelFileId: uuid('model_file_id').notNull(),\n\n /** 动作文件ID */\n motionFileId: uuid('motion_file_id'),\n\n /** 相机动画文件ID */\n cameraFileId: uuid('camera_file_id'),\n\n /** 音频文件ID */\n audioFileId: uuid('audio_file_id'),\n\n /** 舞台模型文件ID */\n stageModelFileId: uuid('stage_model_file_id'),\n\n /** 附加动作文件ID列表(JSON数组) */\n additionalMotionFileIds: json('additional_motion_file_ids').$type<string[]>(),\n\n /** 额外配置(JSON格式) */\n config: json('config'),\n\n /** 创建时间 */\n createdAt: timestamp('created_at').defaultNow().notNull(),\n\n /** 更新时间 */\n updatedAt: timestamp('updated_at').defaultNow().notNull(),\n },\n (table) => ({\n /** 按播放列表查询的索引 */\n playlistIndex: index('mmd_playlist_nodes_playlist_idx').on(table.playlistId),\n\n /** 按排序查询的索引 */\n sortOrderIndex: index('mmd_playlist_nodes_sort_order_idx').on(table.sortOrder),\n\n /** 按模型文件查询的索引 */\n modelFileIndex: index('mmd_playlist_nodes_model_file_idx').on(table.modelFileId),\n\n /** 组合索引:播放列表+排序 */\n playlistSortIndex: index('mmd_playlist_nodes_playlist_sort_idx').on(\n table.playlistId,\n table.sortOrder\n ),\n })\n);\n\n/**\n * MMD资源选项表 (mmd_resource_options)\n * \n * 管理可选的MMD资源(用于自由组合模式)\n */\nexport const mmdResourceOptions = pgTable(\n 'mmd_resource_options',\n {\n /** 主键ID */\n id: uuid('id').primaryKey().defaultRandom(),\n\n /** 资源名称 */\n name: varchar('name', { length: 255 }).notNull(),\n\n /** 资源描述 */\n description: text('description'),\n\n /** 资源类型: model, motion, camera, audio, stage */\n resourceType: varchar('resource_type', { length: 20 }).notNull(),\n\n /** 文件ID (关联 file_metadata.id) */\n fileId: uuid('file_id').notNull(),\n\n /** 缩略图文件ID */\n thumbnailFileId: uuid('thumbnail_file_id'),\n\n /** 资源标签(JSON数组,用于分类和筛选) */\n tags: json('tags').$type<string[]>(),\n\n /** 显示顺序 */\n sortOrder: integer('sort_order').notNull().default(0),\n\n /** 是否启用 */\n isActive: boolean('is_active').notNull().default(true),\n\n /** 创建者ID */\n createdBy: varchar('created_by', { length: 255 }).notNull(),\n\n /** 创建时间 */\n createdAt: timestamp('created_at').defaultNow().notNull(),\n\n /** 更新时间 */\n updatedAt: timestamp('updated_at').defaultNow().notNull(),\n },\n (table) => ({\n /** 按资源类型查询的索引 */\n resourceTypeIndex: index('mmd_resource_options_resource_type_idx').on(table.resourceType),\n\n /** 按文件ID查询的索引 */\n fileIdIndex: index('mmd_resource_options_file_id_idx').on(table.fileId),\n\n /** 按活跃状态查询的索引 */\n isActiveIndex: index('mmd_resource_options_is_active_idx').on(table.isActive),\n\n /** 按创建者查询的索引 */\n createdByIndex: index('mmd_resource_options_created_by_idx').on(table.createdBy),\n\n /** 组合索引:资源类型+活跃状态+排序 */\n typeActiveSortIndex: index('mmd_resource_options_type_active_sort_idx').on(\n table.resourceType,\n table.isActive,\n table.sortOrder\n ),\n })\n);\n\n/**\n * MMD预设列表项表 (mmd_preset_items)\n * \n * 管理预设的MMD资源组合(用于列表模式)\n */\nexport const mmdPresetItems = pgTable(\n 'mmd_preset_items',\n {\n /** 主键ID */\n id: uuid('id').primaryKey().defaultRandom(),\n\n /** 预设名称 */\n name: varchar('name', { length: 255 }).notNull(),\n\n /** 预设描述 */\n description: text('description'),\n\n /** 缩略图文件ID */\n thumbnailFileId: uuid('thumbnail_file_id'),\n\n /** 模型文件ID */\n modelFileId: uuid('model_file_id').notNull(),\n\n /** 动作文件ID */\n motionFileId: uuid('motion_file_id'),\n\n /** 相机动画文件ID */\n cameraFileId: uuid('camera_file_id'),\n\n /** 音频文件ID */\n audioFileId: uuid('audio_file_id'),\n\n /** 舞台模型文件ID */\n stageModelFileId: uuid('stage_model_file_id'),\n\n /** 附加动作文件ID列表(JSON数组) */\n additionalMotionFileIds: json('additional_motion_file_ids').$type<string[]>(),\n\n /** 显示顺序 */\n sortOrder: integer('sort_order').notNull().default(0),\n\n /** 是否启用 */\n isActive: boolean('is_active').notNull().default(true),\n\n /** 预设标签(JSON数组) */\n tags: json('tags').$type<string[]>(),\n\n /** 创建者ID */\n createdBy: varchar('created_by', { length: 255 }).notNull(),\n\n /** 创建时间 */\n createdAt: timestamp('created_at').defaultNow().notNull(),\n\n /** 更新时间 */\n updatedAt: timestamp('updated_at').defaultNow().notNull(),\n },\n (table) => ({\n /** 按活跃状态查询的索引 */\n isActiveIndex: index('mmd_preset_items_is_active_idx').on(table.isActive),\n\n /** 按排序查询的索引 */\n sortOrderIndex: index('mmd_preset_items_sort_order_idx').on(table.sortOrder),\n\n /** 按创建者查询的索引 */\n createdByIndex: index('mmd_preset_items_created_by_idx').on(table.createdBy),\n\n /** 按模型文件查询的索引 */\n modelFileIndex: index('mmd_preset_items_model_file_idx').on(table.modelFileId),\n })\n);\n\n// ========== 关系定义 ==========\n\nexport const mmdPlaylistsRelations = relations(mmdPlaylists, ({ many }) => ({\n nodes: many(mmdPlaylistNodes),\n}));\n\nexport const mmdPlaylistNodesRelations = relations(mmdPlaylistNodes, ({ one }) => ({\n playlist: one(mmdPlaylists, {\n fields: [mmdPlaylistNodes.playlistId],\n references: [mmdPlaylists.id],\n }),\n}));\n\n// ========== 导出类型 ==========\n\nexport type MmdPlaylist = typeof mmdPlaylists.$inferSelect;\nexport type NewMmdPlaylist = typeof mmdPlaylists.$inferInsert;\n\nexport type MmdPlaylistNode = typeof mmdPlaylistNodes.$inferSelect;\nexport type NewMmdPlaylistNode = typeof mmdPlaylistNodes.$inferInsert;\n\nexport type MmdResourceOption = typeof mmdResourceOptions.$inferSelect;\nexport type NewMmdResourceOption = typeof mmdResourceOptions.$inferInsert;\n\nexport type MmdPresetItem = typeof mmdPresetItems.$inferSelect;\nexport type NewMmdPresetItem = typeof mmdPresetItems.$inferInsert;\n\n"]}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var drizzleOrm = require('drizzle-orm');
|
|
4
|
+
var pgCore = require('drizzle-orm/pg-core');
|
|
5
|
+
|
|
6
|
+
// src/mmd/server/drizzle-schema.ts
|
|
7
|
+
var mmdPlaylists = pgCore.pgTable(
|
|
8
|
+
"mmd_playlists",
|
|
9
|
+
{
|
|
10
|
+
/** 主键ID */
|
|
11
|
+
id: pgCore.uuid("id").primaryKey().defaultRandom(),
|
|
12
|
+
/** 播放列表名称 */
|
|
13
|
+
name: pgCore.varchar("name", { length: 255 }).notNull(),
|
|
14
|
+
/** 播放列表描述 */
|
|
15
|
+
description: pgCore.text("description"),
|
|
16
|
+
/** 是否启用列表循环 */
|
|
17
|
+
loop: pgCore.boolean("loop").notNull().default(false),
|
|
18
|
+
/** 预加载策略: none, next, all */
|
|
19
|
+
preloadStrategy: pgCore.varchar("preload_strategy", { length: 20 }).notNull().default("none"),
|
|
20
|
+
/** 是否自动播放 */
|
|
21
|
+
autoPlay: pgCore.boolean("auto_play").notNull().default(false),
|
|
22
|
+
/** 播放列表缩略图文件ID (关联 file_metadata.id) */
|
|
23
|
+
thumbnailFileId: pgCore.uuid("thumbnail_file_id"),
|
|
24
|
+
/** 播放列表状态: draft, published, archived */
|
|
25
|
+
status: pgCore.varchar("status", { length: 20 }).notNull().default("draft"),
|
|
26
|
+
/** 显示顺序 */
|
|
27
|
+
sortOrder: pgCore.integer("sort_order").notNull().default(0),
|
|
28
|
+
/** 额外配置(JSON格式,存储舞台配置等) */
|
|
29
|
+
config: pgCore.json("config"),
|
|
30
|
+
/** 创建者ID */
|
|
31
|
+
createdBy: pgCore.varchar("created_by", { length: 255 }).notNull(),
|
|
32
|
+
/** 创建时间 */
|
|
33
|
+
createdAt: pgCore.timestamp("created_at").defaultNow().notNull(),
|
|
34
|
+
/** 更新时间 */
|
|
35
|
+
updatedAt: pgCore.timestamp("updated_at").defaultNow().notNull(),
|
|
36
|
+
/** 删除时间(软删除) */
|
|
37
|
+
deletedAt: pgCore.timestamp("deleted_at")
|
|
38
|
+
},
|
|
39
|
+
(table) => ({
|
|
40
|
+
/** 按状态查询的索引 */
|
|
41
|
+
statusIndex: pgCore.index("mmd_playlists_status_idx").on(table.status),
|
|
42
|
+
/** 按创建者查询的索引 */
|
|
43
|
+
createdByIndex: pgCore.index("mmd_playlists_created_by_idx").on(table.createdBy),
|
|
44
|
+
/** 按删除状态查询的索引 */
|
|
45
|
+
deletedAtIndex: pgCore.index("mmd_playlists_deleted_at_idx").on(table.deletedAt),
|
|
46
|
+
/** 按排序查询的索引 */
|
|
47
|
+
sortOrderIndex: pgCore.index("mmd_playlists_sort_order_idx").on(table.sortOrder)
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
var mmdPlaylistNodes = pgCore.pgTable(
|
|
51
|
+
"mmd_playlist_nodes",
|
|
52
|
+
{
|
|
53
|
+
/** 主键ID */
|
|
54
|
+
id: pgCore.uuid("id").primaryKey().defaultRandom(),
|
|
55
|
+
/** 所属播放列表ID */
|
|
56
|
+
playlistId: pgCore.uuid("playlist_id").references(() => mmdPlaylists.id, { onDelete: "cascade" }).notNull(),
|
|
57
|
+
/** 节点名称 */
|
|
58
|
+
name: pgCore.varchar("name", { length: 255 }).notNull(),
|
|
59
|
+
/** 节点描述 */
|
|
60
|
+
description: pgCore.text("description"),
|
|
61
|
+
/** 是否启用节点循环 */
|
|
62
|
+
loop: pgCore.boolean("loop").notNull().default(false),
|
|
63
|
+
/** 预计时长(秒) */
|
|
64
|
+
duration: pgCore.integer("duration"),
|
|
65
|
+
/** 节点缩略图文件ID */
|
|
66
|
+
thumbnailFileId: pgCore.uuid("thumbnail_file_id"),
|
|
67
|
+
/** 显示顺序 */
|
|
68
|
+
sortOrder: pgCore.integer("sort_order").notNull().default(0),
|
|
69
|
+
/** 模型文件ID (关联 file_metadata.id) */
|
|
70
|
+
modelFileId: pgCore.uuid("model_file_id").notNull(),
|
|
71
|
+
/** 动作文件ID */
|
|
72
|
+
motionFileId: pgCore.uuid("motion_file_id"),
|
|
73
|
+
/** 相机动画文件ID */
|
|
74
|
+
cameraFileId: pgCore.uuid("camera_file_id"),
|
|
75
|
+
/** 音频文件ID */
|
|
76
|
+
audioFileId: pgCore.uuid("audio_file_id"),
|
|
77
|
+
/** 舞台模型文件ID */
|
|
78
|
+
stageModelFileId: pgCore.uuid("stage_model_file_id"),
|
|
79
|
+
/** 附加动作文件ID列表(JSON数组) */
|
|
80
|
+
additionalMotionFileIds: pgCore.json("additional_motion_file_ids").$type(),
|
|
81
|
+
/** 额外配置(JSON格式) */
|
|
82
|
+
config: pgCore.json("config"),
|
|
83
|
+
/** 创建时间 */
|
|
84
|
+
createdAt: pgCore.timestamp("created_at").defaultNow().notNull(),
|
|
85
|
+
/** 更新时间 */
|
|
86
|
+
updatedAt: pgCore.timestamp("updated_at").defaultNow().notNull()
|
|
87
|
+
},
|
|
88
|
+
(table) => ({
|
|
89
|
+
/** 按播放列表查询的索引 */
|
|
90
|
+
playlistIndex: pgCore.index("mmd_playlist_nodes_playlist_idx").on(table.playlistId),
|
|
91
|
+
/** 按排序查询的索引 */
|
|
92
|
+
sortOrderIndex: pgCore.index("mmd_playlist_nodes_sort_order_idx").on(table.sortOrder),
|
|
93
|
+
/** 按模型文件查询的索引 */
|
|
94
|
+
modelFileIndex: pgCore.index("mmd_playlist_nodes_model_file_idx").on(table.modelFileId),
|
|
95
|
+
/** 组合索引:播放列表+排序 */
|
|
96
|
+
playlistSortIndex: pgCore.index("mmd_playlist_nodes_playlist_sort_idx").on(
|
|
97
|
+
table.playlistId,
|
|
98
|
+
table.sortOrder
|
|
99
|
+
)
|
|
100
|
+
})
|
|
101
|
+
);
|
|
102
|
+
var mmdResourceOptions = pgCore.pgTable(
|
|
103
|
+
"mmd_resource_options",
|
|
104
|
+
{
|
|
105
|
+
/** 主键ID */
|
|
106
|
+
id: pgCore.uuid("id").primaryKey().defaultRandom(),
|
|
107
|
+
/** 资源名称 */
|
|
108
|
+
name: pgCore.varchar("name", { length: 255 }).notNull(),
|
|
109
|
+
/** 资源描述 */
|
|
110
|
+
description: pgCore.text("description"),
|
|
111
|
+
/** 资源类型: model, motion, camera, audio, stage */
|
|
112
|
+
resourceType: pgCore.varchar("resource_type", { length: 20 }).notNull(),
|
|
113
|
+
/** 文件ID (关联 file_metadata.id) */
|
|
114
|
+
fileId: pgCore.uuid("file_id").notNull(),
|
|
115
|
+
/** 缩略图文件ID */
|
|
116
|
+
thumbnailFileId: pgCore.uuid("thumbnail_file_id"),
|
|
117
|
+
/** 资源标签(JSON数组,用于分类和筛选) */
|
|
118
|
+
tags: pgCore.json("tags").$type(),
|
|
119
|
+
/** 显示顺序 */
|
|
120
|
+
sortOrder: pgCore.integer("sort_order").notNull().default(0),
|
|
121
|
+
/** 是否启用 */
|
|
122
|
+
isActive: pgCore.boolean("is_active").notNull().default(true),
|
|
123
|
+
/** 创建者ID */
|
|
124
|
+
createdBy: pgCore.varchar("created_by", { length: 255 }).notNull(),
|
|
125
|
+
/** 创建时间 */
|
|
126
|
+
createdAt: pgCore.timestamp("created_at").defaultNow().notNull(),
|
|
127
|
+
/** 更新时间 */
|
|
128
|
+
updatedAt: pgCore.timestamp("updated_at").defaultNow().notNull()
|
|
129
|
+
},
|
|
130
|
+
(table) => ({
|
|
131
|
+
/** 按资源类型查询的索引 */
|
|
132
|
+
resourceTypeIndex: pgCore.index("mmd_resource_options_resource_type_idx").on(table.resourceType),
|
|
133
|
+
/** 按文件ID查询的索引 */
|
|
134
|
+
fileIdIndex: pgCore.index("mmd_resource_options_file_id_idx").on(table.fileId),
|
|
135
|
+
/** 按活跃状态查询的索引 */
|
|
136
|
+
isActiveIndex: pgCore.index("mmd_resource_options_is_active_idx").on(table.isActive),
|
|
137
|
+
/** 按创建者查询的索引 */
|
|
138
|
+
createdByIndex: pgCore.index("mmd_resource_options_created_by_idx").on(table.createdBy),
|
|
139
|
+
/** 组合索引:资源类型+活跃状态+排序 */
|
|
140
|
+
typeActiveSortIndex: pgCore.index("mmd_resource_options_type_active_sort_idx").on(
|
|
141
|
+
table.resourceType,
|
|
142
|
+
table.isActive,
|
|
143
|
+
table.sortOrder
|
|
144
|
+
)
|
|
145
|
+
})
|
|
146
|
+
);
|
|
147
|
+
var mmdPresetItems = pgCore.pgTable(
|
|
148
|
+
"mmd_preset_items",
|
|
149
|
+
{
|
|
150
|
+
/** 主键ID */
|
|
151
|
+
id: pgCore.uuid("id").primaryKey().defaultRandom(),
|
|
152
|
+
/** 预设名称 */
|
|
153
|
+
name: pgCore.varchar("name", { length: 255 }).notNull(),
|
|
154
|
+
/** 预设描述 */
|
|
155
|
+
description: pgCore.text("description"),
|
|
156
|
+
/** 缩略图文件ID */
|
|
157
|
+
thumbnailFileId: pgCore.uuid("thumbnail_file_id"),
|
|
158
|
+
/** 模型文件ID */
|
|
159
|
+
modelFileId: pgCore.uuid("model_file_id").notNull(),
|
|
160
|
+
/** 动作文件ID */
|
|
161
|
+
motionFileId: pgCore.uuid("motion_file_id"),
|
|
162
|
+
/** 相机动画文件ID */
|
|
163
|
+
cameraFileId: pgCore.uuid("camera_file_id"),
|
|
164
|
+
/** 音频文件ID */
|
|
165
|
+
audioFileId: pgCore.uuid("audio_file_id"),
|
|
166
|
+
/** 舞台模型文件ID */
|
|
167
|
+
stageModelFileId: pgCore.uuid("stage_model_file_id"),
|
|
168
|
+
/** 附加动作文件ID列表(JSON数组) */
|
|
169
|
+
additionalMotionFileIds: pgCore.json("additional_motion_file_ids").$type(),
|
|
170
|
+
/** 显示顺序 */
|
|
171
|
+
sortOrder: pgCore.integer("sort_order").notNull().default(0),
|
|
172
|
+
/** 是否启用 */
|
|
173
|
+
isActive: pgCore.boolean("is_active").notNull().default(true),
|
|
174
|
+
/** 预设标签(JSON数组) */
|
|
175
|
+
tags: pgCore.json("tags").$type(),
|
|
176
|
+
/** 创建者ID */
|
|
177
|
+
createdBy: pgCore.varchar("created_by", { length: 255 }).notNull(),
|
|
178
|
+
/** 创建时间 */
|
|
179
|
+
createdAt: pgCore.timestamp("created_at").defaultNow().notNull(),
|
|
180
|
+
/** 更新时间 */
|
|
181
|
+
updatedAt: pgCore.timestamp("updated_at").defaultNow().notNull()
|
|
182
|
+
},
|
|
183
|
+
(table) => ({
|
|
184
|
+
/** 按活跃状态查询的索引 */
|
|
185
|
+
isActiveIndex: pgCore.index("mmd_preset_items_is_active_idx").on(table.isActive),
|
|
186
|
+
/** 按排序查询的索引 */
|
|
187
|
+
sortOrderIndex: pgCore.index("mmd_preset_items_sort_order_idx").on(table.sortOrder),
|
|
188
|
+
/** 按创建者查询的索引 */
|
|
189
|
+
createdByIndex: pgCore.index("mmd_preset_items_created_by_idx").on(table.createdBy),
|
|
190
|
+
/** 按模型文件查询的索引 */
|
|
191
|
+
modelFileIndex: pgCore.index("mmd_preset_items_model_file_idx").on(table.modelFileId)
|
|
192
|
+
})
|
|
193
|
+
);
|
|
194
|
+
var mmdPlaylistsRelations = drizzleOrm.relations(mmdPlaylists, ({ many }) => ({
|
|
195
|
+
nodes: many(mmdPlaylistNodes)
|
|
196
|
+
}));
|
|
197
|
+
var mmdPlaylistNodesRelations = drizzleOrm.relations(mmdPlaylistNodes, ({ one }) => ({
|
|
198
|
+
playlist: one(mmdPlaylists, {
|
|
199
|
+
fields: [mmdPlaylistNodes.playlistId],
|
|
200
|
+
references: [mmdPlaylists.id]
|
|
201
|
+
})
|
|
202
|
+
}));
|
|
203
|
+
|
|
204
|
+
exports.mmdPlaylistNodes = mmdPlaylistNodes;
|
|
205
|
+
exports.mmdPlaylistNodesRelations = mmdPlaylistNodesRelations;
|
|
206
|
+
exports.mmdPlaylists = mmdPlaylists;
|
|
207
|
+
exports.mmdPlaylistsRelations = mmdPlaylistsRelations;
|
|
208
|
+
exports.mmdPresetItems = mmdPresetItems;
|
|
209
|
+
exports.mmdResourceOptions = mmdResourceOptions;
|
|
210
|
+
//# sourceMappingURL=chunk-W35VTQAW.js.map
|
|
211
|
+
//# sourceMappingURL=chunk-W35VTQAW.js.map
|