book-index-ui 0.2.11 → 0.2.13

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/index.d.ts CHANGED
@@ -250,6 +250,10 @@ export declare class BundleStorage implements IndexStorage {
250
250
  private searchSCache;
251
251
  private searchSLoading;
252
252
  private searchSLoaded;
253
+ private metaCache;
254
+ private metaLoading;
255
+ /** null = 已尝试加载 meta.json 但失败/缺失(fallback 到 ensureLoaded) */
256
+ private metaTried;
253
257
  private t2sConverter;
254
258
  private t2sLoading;
255
259
  /** 数据版本(commitId 前 12 位)。null=已尝试加载但失败;undefined=未加载 */
@@ -275,14 +279,24 @@ export declare class BundleStorage implements IndexStorage {
275
279
  /** Load chunk for a specific ID using manifest-based prefix resolution */
276
280
  private loadChunkForId;
277
281
  private loadTiyaoGroup;
282
+ /**
283
+ * 获取轻量元数据(< 1 KB)。优先读 /data/meta.json;
284
+ * 若该文件不存在(旧 bundle),回退到 ensureLoaded 计算。
285
+ */
286
+ getCounts(): Promise<IndexCounts>;
278
287
  getResourceCounts(): Promise<{
279
288
  hasText: number;
280
289
  hasImage: number;
281
290
  }>;
291
+ getSubtypeStats(): Promise<Record<string, number>>;
282
292
  loadEntries(type: IndexType, options: LoadOptions): Promise<PageResult<IndexEntry>>;
283
293
  search(query: string, type: IndexType, options: LoadOptions): Promise<PageResult<IndexEntry>>;
284
294
  searchAll(query: string, limit?: number): Promise<GroupedSearchResult>;
285
295
  getItem(id: string): Promise<Record<string, unknown> | null>;
296
+ /**
297
+ * 优先用 chunk 构造 IndexEntry,避免触发 ensureLoaded() 拉全量 index.json。
298
+ * 旧 bundle 没有把 has_collated 等字段注入 chunk 时回退到 ensureLoaded。
299
+ */
286
300
  getEntry(id: string): Promise<IndexEntry | null>;
287
301
  getAllEntries(): Promise<IndexEntry[]>;
288
302
  saveItem(): Promise<{
@@ -975,6 +989,18 @@ declare interface IndexBrowserProps {
975
989
  headerRight?: default_2.ReactNode;
976
990
  }
977
991
 
992
+ declare interface IndexCounts {
993
+ works: number;
994
+ books: number;
995
+ collections: number;
996
+ entities: number;
997
+ resourceCounts?: {
998
+ hasText: number;
999
+ hasImage: number;
1000
+ };
1001
+ subtypeStats?: Record<string, number>;
1002
+ }
1003
+
978
1004
  export declare const IndexDetail: default_2.FC<IndexDetailProps>;
979
1005
 
980
1006
  /** 统一详情数据类型 */
@@ -1228,6 +1254,14 @@ export declare interface IndexStorage {
1228
1254
  }>;
1229
1255
  /** 获取 Work subtype 细分统计 */
1230
1256
  getSubtypeStats?(): Promise<Record<string, number>>;
1257
+ /**
1258
+ * 一次性获取索引规模 + 资源 + subtype 统计的轻量元数据。
1259
+ *
1260
+ * 用于代替 getAllEntries() / loadEntries(t,{page:1,pageSize:1}) ×4 等
1261
+ * "为了几个数字下载整个 index" 的场景。BundleStorage 实现读取
1262
+ * /data/meta.json(< 1 KB),其它实现可选。
1263
+ */
1264
+ getCounts?(): Promise<IndexCounts>;
1231
1265
  }
1232
1266
 
1233
1267
  /** 索引类型 */