next-flow-interface 0.27.13 → 0.27.15

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.
Files changed (2) hide show
  1. package/index.d.ts +72 -3
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2489,6 +2489,18 @@ export declare class LocalDataService {
2489
2489
  * @public
2490
2490
  */
2491
2491
  add(option: AddLocalDataOption): LocalData;
2492
+ /**
2493
+ * 将已有的本地数据重映射到新的文件 ID
2494
+ *
2495
+ * 上传文件时使用临时 ID 存储,上传完成后需要替换为后端返回的真实 fileId,
2496
+ * 以确保刷新页面后仍能通过真实 fileId 找到数据。
2497
+ *
2498
+ * @param oldFid - 旧的临时文件 ID
2499
+ * @param newFid - 新的真实文件 ID
2500
+ * @returns 是否成功重映射
2501
+ * @public
2502
+ */
2503
+ remap(oldFid: string, newFid: string): boolean;
2492
2504
  /**
2493
2505
  * 加载一个文件到本地
2494
2506
  *
@@ -3290,6 +3302,15 @@ export declare class OssUploadService {
3290
3302
  private initialize;
3291
3303
  /** 正在上传的实例 Map(fid -> OssUploadInstance) */
3292
3304
  instances: Map<string, OssUploadInstance>;
3305
+ /**
3306
+ * 已完成上传但尚未获得 resourceId 的 rbFile.id 集合
3307
+ *
3308
+ * rhine-base 上传流程分两步:
3309
+ * 1. 文件上传完成 → status='complete'(此时无 resourceId)
3310
+ * 2. 后端创建资源 → resourceId 被设置(再次 notify)
3311
+ * 需要在第二步时识别出该文件并写入协同数据
3312
+ */
3313
+ private pendingResourceIds;
3293
3314
  /**
3294
3315
  * 根据 fid 获取上传实例
3295
3316
  *
@@ -4185,6 +4206,38 @@ export declare class ResourceService {
4185
4206
  * @returns PNG 格式的 File 对象,失败返回 null
4186
4207
  */
4187
4208
  generatePreviewForTexture(texture: BaseTexture, filename?: string): Promise<File | null>;
4209
+ /**
4210
+ * 上传文件并等待完成
4211
+ *
4212
+ * 监听上传和资源添加事件,成功时返回 resourceId,失败时 reject。
4213
+ *
4214
+ * @param file - 浏览器 File 对象
4215
+ * @param fid - 可选的文件 ID,不传则由上传服务自动生成
4216
+ * @returns Promise<resourceId>,上传成功返回资源 ID,失败则 reject
4217
+ */
4218
+ uploadAndWait(file: File, fid?: string): Promise<string>;
4219
+ /**
4220
+ * 批量上传文件并等待所有完成
4221
+ *
4222
+ * 自动检测重复文件并提示用户。返回成功上传的资源 ID 列表。
4223
+ *
4224
+ * @param fileList - 文件列表,支持 FileList、File[]、单个 File 或 null
4225
+ * @param fidList - 可选的文件 ID 列表,与 fileList 一一对应
4226
+ * @returns Promise<resourceId[]>,成功上传的资源 ID 列表
4227
+ */
4228
+ uploadMultiAndWait(fileList: FileList | File[] | File | null | undefined, fidList?: string[]): Promise<string[]>;
4229
+ /**
4230
+ * 通过已有文件 ID 创建资源
4231
+ *
4232
+ * 调用后端资源创建接口,在当前用户容器中创建一个引用指定文件的资源。
4233
+ * 创建成功后自动将资源元数据写入缓存并添加到协同数据。
4234
+ *
4235
+ * @param fileId - 已存在的后端文件 ID
4236
+ * @param name - 资源名称
4237
+ * @returns 创建成功的 resourceId
4238
+ * @public
4239
+ */
4240
+ createByFileId(fileId: string, name: string): Promise<string>;
4188
4241
  /**
4189
4242
  * 生成资源/文件 ID
4190
4243
  *
@@ -5997,6 +6050,8 @@ export declare class RvResourceService {
5997
6050
  private fileToResourceMap;
5998
6051
  /**
5999
6052
  * 添加 resourceId 到协同数据
6053
+ *
6054
+ * 如果资源元数据已在缓存中,会自动同步文件元数据并触发下载
6000
6055
  */
6001
6056
  add(resourceId: string): void;
6002
6057
  /**
@@ -6049,13 +6104,27 @@ export declare class RvResourceService {
6049
6104
  */
6050
6105
  getDownloadUrl(fileId: string): Promise<string>;
6051
6106
  /**
6052
- * 从后端同步资源列表到协同数据和本地缓存
6107
+ * 从后端同步资源列表到本地缓存
6053
6108
  *
6054
6109
  * 通过 listResources 一次性拉取后端完整资源列表,
6055
- * 将缺失的 resourceId 补写回协同数据,
6056
- * 同时填充本地元数据缓存并通知文件订阅者。
6110
+ * 仅填充本地元数据缓存,不自动添加到协同数据。
6111
+ * 需要手动调用 add() 方法将资源添加到协同数据。
6112
+ *
6113
+ * 同步完成后会自动清理孤立资源(没有对应文件的资源)
6057
6114
  */
6058
6115
  syncFromBackend(): Promise<void>;
6116
+ /**
6117
+ * 获取所有后端资源的元数据列表(从本地缓存)
6118
+ *
6119
+ * @returns 资源元数据数组
6120
+ */
6121
+ getAllMetadata(): Resource[];
6122
+ /**
6123
+ * 获取所有未添加到协同数据的资源列表
6124
+ *
6125
+ * @returns 未添加的资源元数据数组
6126
+ */
6127
+ getUnaddedResources(): Resource[];
6059
6128
  /**
6060
6129
  * 订阅资源列表变化事件(ADD/REMOVE)
6061
6130
  */
package/package.json CHANGED
@@ -36,7 +36,7 @@
36
36
  "valtio": "2.1.7",
37
37
  "rhine-var": "2.4.3"
38
38
  },
39
- "version": "0.27.13",
39
+ "version": "0.27.15",
40
40
  "author": "NextFlow",
41
41
  "license": "Apache-2.0",
42
42
  "keywords": [