next-flow-interface 0.27.14 → 0.27.16

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 +67 -2
  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
  *
@@ -6002,7 +6055,7 @@ export declare class RvResourceService {
6002
6055
  */
6003
6056
  add(resourceId: string): void;
6004
6057
  /**
6005
- * 从协同数据移除 resourceId
6058
+ * 从协同数据移除 resourceId,并清理 fileToResourceMap 中的映射
6006
6059
  */
6007
6060
  remove(resourceId: string): boolean;
6008
6061
  /**
@@ -6014,9 +6067,19 @@ export declare class RvResourceService {
6014
6067
  */
6015
6068
  getMetadata(resourceId: string): Resource | undefined;
6016
6069
  /**
6017
- * 通过 fileId 获取对应的资源元数据
6070
+ * 通过 fileId 获取对应的资源元数据(返回第一个匹配的资源)
6071
+ *
6072
+ * @deprecated 当一个文件对应多个资源时,此方法只返回第一个。建议使用 getAllMetadataByFileId()
6018
6073
  */
6019
6074
  getMetadataByFileId(fileId: string): Resource | undefined;
6075
+ /**
6076
+ * 通过 fileId 获取所有对应的资源元数据列表
6077
+ */
6078
+ getAllMetadataByFileId(fileId: string): Resource[];
6079
+ /**
6080
+ * 通过 fileId 获取所有对应的 resourceId 列表
6081
+ */
6082
+ getResourceIdsByFileId(fileId: string): string[];
6020
6083
  /**
6021
6084
  * 设置资源元数据缓存
6022
6085
  */
@@ -6056,6 +6119,8 @@ export declare class RvResourceService {
6056
6119
  * 通过 listResources 一次性拉取后端完整资源列表,
6057
6120
  * 仅填充本地元数据缓存,不自动添加到协同数据。
6058
6121
  * 需要手动调用 add() 方法将资源添加到协同数据。
6122
+ *
6123
+ * 同步完成后会自动清理孤立资源(没有对应文件的资源)
6059
6124
  */
6060
6125
  syncFromBackend(): Promise<void>;
6061
6126
  /**
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.14",
39
+ "version": "0.27.16",
40
40
  "author": "NextFlow",
41
41
  "license": "Apache-2.0",
42
42
  "keywords": [