@keepkit/core 0.28.19 → 0.28.20

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [日本語](#日本語) | [English](#english)
4
4
 
5
- Release: v0.28.19
5
+ Release: v0.28.20
6
6
 
7
7
  ## 日本語
8
8
 
@@ -74,7 +74,7 @@ hooksはProvider内のコンポーネントで呼び出します。
74
74
  | 複数コレクションへの所属・順序 | `addKeepItemToCollection`、`getKeepCollectionItems`、`reorderKeepCollectionItems`、`removeKeepItemFromCollection` |
75
75
  | 再発見 | `useKeepItem(item).recordOpen()`、`createRediscoveryQuery`、`useKeepRediscovery` |
76
76
  | 閲覧履歴・鑑賞記録・進行位置 | `LocalStorageKeepHistoryStorage`、`LocalStorageKeepViewingRecordStorage`、`LocalStorageKeepProgressStorage` |
77
- | 保存対象の再検証 | Providerの`validateItem` / `resolveItem`、`revalidateItems` |
77
+ | 保存対象の再検証 | Providerの`validateItem` / `resolveItem`、`autoRevalidation.revalidateMany`、`revalidateItems` |
78
78
 
79
79
  一覧は未アーカイブのアイテムを既定で返します。`archiveScope: "all"`で両方を、`archived: true`でアーカイブを取得できます。
80
80
  複数コレクションへの所属はアイテムと別に保存され、所属を外しても共有アイテムやメモは残ります。
@@ -202,7 +202,7 @@ Use `keep.useItem(article)` for saves, removal, and note updates, and `keep.useL
202
202
  | Multiple collections and ordering | `addKeepItemToCollection`, `getKeepCollectionItems`, `reorderKeepCollectionItems`, `removeKeepItemFromCollection` |
203
203
  | Rediscovery | `useKeepItem(item).recordOpen()`, `createRediscoveryQuery`, and `useKeepRediscovery` |
204
204
  | History, viewing records, and progress | `LocalStorageKeepHistoryStorage`, `LocalStorageKeepViewingRecordStorage`, `LocalStorageKeepProgressStorage` |
205
- | Source revalidation | Provider `validateItem` / `resolveItem` and `revalidateItems` |
205
+ | Source revalidation | Provider `validateItem` / `resolveItem`, `autoRevalidation.revalidateMany`, and `revalidateItems` |
206
206
 
207
207
  Lists return unarchived items by default. Use `archiveScope: "all"` for both or `archived: true` for archived items.
208
208
  Memberships are stored separately; removing one leaves the shared item and note intact.
@@ -250,3 +250,8 @@ Browser writes to localStorage history, viewing records, and progress require th
250
250
  Namespace history and progress keys per account, and pass matching language, content version, and audio ID when reading progress.
251
251
 
252
252
  See the [repository README](../../README.md) for demos and development, and the [release notes](../../RELEASE_NOTES.md) for changes.
253
+
254
+
255
+ `autoRevalidation={{ revalidateMany: async (items) => statuses }}` batches mount, reconnect and manual `revalidateItems()` calls. Return a status or revalidation result for every item ID; an incomplete response fails without applying changes. An explicitly passed single-item revalidator takes precedence.
256
+
257
+ `autoRevalidation.revalidateMany` はマウント時・再接続時・引数なしの `revalidateItems()` を一括処理します。全アイテムIDに対するステータスまたは検証結果を返してください。不完全な応答は変更せず失敗します。単件コールバックを明示した場合はそちらを使用します。
@@ -1,6 +1,7 @@
1
1
  import {
2
+ stripUndefinedMeta,
2
3
  validateKeepItem
3
- } from "./chunk-5W4QSJHV.js";
4
+ } from "./chunk-R5BTN27K.js";
4
5
 
5
6
  // src/features/items/types.ts
6
7
  var KeepSyncAuthError = class extends Error {
@@ -57,6 +58,10 @@ function normalizeKeepTags(tags) {
57
58
 
58
59
  // src/features/persistence/helpers.ts
59
60
  async function persistKeepItems(storage, items) {
61
+ items = items.map((item) => {
62
+ const meta = stripUndefinedMeta(item.meta);
63
+ return meta === item.meta ? item : { ...item, meta };
64
+ });
60
65
  if (storage.setMany) {
61
66
  await storage.setMany(items);
62
67
  return;
@@ -2620,12 +2625,18 @@ var FallbackStorageAdapter = class {
2620
2625
  return this.readAll();
2621
2626
  }
2622
2627
  set(item) {
2628
+ const meta = stripUndefinedMeta(item.meta);
2629
+ if (meta !== item.meta) item = { ...item, meta };
2623
2630
  if (this.scope) item = { ...item, scope: this.scope };
2624
2631
  if (this.journalController)
2625
2632
  return this.journalController.write({ type: "setItems", items: [item] }, (adapter) => adapter.set(item));
2626
2633
  return this.executeWrite((adapter) => adapter.set(item));
2627
2634
  }
2628
2635
  setMany(items) {
2636
+ items = items.map((item) => {
2637
+ const meta = stripUndefinedMeta(item.meta);
2638
+ return meta === item.meta ? item : { ...item, meta };
2639
+ });
2629
2640
  if (this.scope) items = items.map((item) => ({ ...item, scope: this.scope }));
2630
2641
  if (this.journalController) return this.journalController.write({ type: "setItems", items });
2631
2642
  return this.executeWrite(
@@ -2978,6 +2989,10 @@ var LocalStorageAdapter = class {
2978
2989
  await this.setMany([item]);
2979
2990
  }
2980
2991
  async setMany(items) {
2992
+ items = items.map((item) => {
2993
+ const meta = stripUndefinedMeta(item.meta);
2994
+ return meta === item.meta ? item : { ...item, meta };
2995
+ });
2981
2996
  const current = await this.getAll();
2982
2997
  const byScopeAndId = new Map(current.map((item) => [getItemStorageKey(item), item]));
2983
2998
  for (const item of items) byScopeAndId.set(getItemStorageKey(item), item);
@@ -3162,6 +3177,10 @@ var IndexedDBAdapter = class {
3162
3177
  return this.setMany([item]);
3163
3178
  }
3164
3179
  async setMany(items) {
3180
+ items = items.map((item) => {
3181
+ const meta = stripUndefinedMeta(item.meta);
3182
+ return meta === item.meta ? item : { ...item, meta };
3183
+ });
3165
3184
  const database = await this.open("set");
3166
3185
  if (!database) return;
3167
3186
  try {
@@ -3446,4 +3465,4 @@ export {
3446
3465
  LocalStorageAdapter,
3447
3466
  IndexedDBAdapter
3448
3467
  };
3449
- //# sourceMappingURL=chunk-HTTOCLOC.js.map
3468
+ //# sourceMappingURL=chunk-IBODMDW3.js.map