@converse/skeletor 3.1.3 → 3.1.5

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/CHANGES.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.1.5 (2026-07-22)
4
+
5
+ - Fix every write through the Node.js SQLite driver failing with `Record Not Found` while
6
+ the data was in fact stored.
7
+ - Switch TypeScript `moduleResolution` to `bundler` and add `types` conditions to the `exports` map.
8
+
9
+ ## 3.1.4 (2026-06-23)
10
+
11
+ - Fix the `autoSync` hydration promise clobbering a consumer's own `initialized` promise.
12
+ The promise that resolves once hydration is complete is now exposed as `hydrated` (on both
13
+ `Model` and `Collection`) instead of `initialized`. The old name collided with the common
14
+ convention (used by Converse.js) of setting a `model.initialized` promise inside
15
+ `initialize()` to track a consumer's own async setup.
16
+
17
+ Skeletor no longer sets or reads `initialized`. Await `model.hydrated` / `collection.hydrated`
18
+ to know when hydration is complete. If you used the autoSync `initialized` promise added
19
+ in 3.1.0, rename those reads to `hydrated`.
20
+
3
21
  ## 3.1.3 (2026-06-23)
4
22
 
5
23
  - Fix a regression (since 3.1.0) where a missing record on a `read` was treated as an error.
package/README.md CHANGED
@@ -1,7 +1,13 @@
1
- # Skeletor
1
+ <p align="center">
2
+ <img src="images/skeletor-logo.svg" alt="Skeletor" width="120" height="120">
3
+ </p>
2
4
 
3
- [![XMPP Chat](https://conference.conversejs.org/muc_badge/discuss@conference.conversejs.org)](https://inverse.chat/#converse/room?jid=discuss@conference.conversejs.org)
4
- [![CI Tests](https://github.com/conversejs/skeletor/actions/workflows/karma-tests.yml/badge.svg)](https://github.com/conversejs/skeletor/actions/workflows/karma-tests.yml)
5
+ <h1 align="center">Skeletor</h1>
6
+
7
+ <p align="center">
8
+ <a href="https://chat.conversejs.org/#converse/room?jid=discuss@conference.conversejs.org"><img alt="XMPP Chat" src="https://conference.conversejs.org/muc_badge/discuss@conference.conversejs.org"></a>
9
+ <a href="https://github.com/conversejs/skeletor/actions/workflows/karma-tests.yml"><img alt="CI Tests" src="https://github.com/conversejs/skeletor/actions/workflows/karma-tests.yml/badge.svg"></a>
10
+ </p>
5
11
 
6
12
  Skeletor is a lightweight, TypeScript-first reactive data library.
7
13
 
@@ -159,7 +165,7 @@ class Settings extends Model {
159
165
  }
160
166
 
161
167
  const settings = new Settings({ id: 'main' });
162
- await settings.initialized; // resolves when prior data has been loaded
168
+ await settings.hydrated; // resolves when prior data has been loaded
163
169
 
164
170
  settings.attrs.theme = 'dark'; // persisted automatically (debounced)
165
171
  settings.set('lang', 'en'); // also auto-saved
@@ -171,7 +177,8 @@ settings.set('transient', true, { noAutoSave: true });
171
177
  Pending writes are debounced (see `autoSyncDelay`, default 100ms) and flushed when the
172
178
  page is hidden (`visibilitychange`) or unloaded (`pagehide`).
173
179
 
174
- When `autoSync` is off, `initialized` is `undefined`, but `await model.initialized` is still safe (awaiting `undefined` is a no-op), so code can await it uniformly.
180
+ When `autoSync` is off, `hydrated` is `undefined`, but `await model.hydrated` is still safe
181
+ (awaiting `undefined` is a no-op), so code can await it uniformly.
175
182
 
176
183
  On a `Collection`, `autoSync` is **hydrate-only**: the collection loads its stored
177
184
  state on construction but does not auto-save on `add`/`remove`/`reset`. To persist
@@ -26,7 +26,7 @@ export declare class Collection<T extends Model = Model> extends EventEmitterObj
26
26
  _storage?: PersistentStorage;
27
27
  _comparator?: Comparator<T>;
28
28
  _url: string;
29
- initialized?: Promise<void>;
29
+ hydrated?: Promise<void>;
30
30
  models: T[];
31
31
  protected _byId: Record<string, T>;
32
32
  protected _model?: new (attributes?: Partial<ModelAttributes>, options?: ModelOptions) => T;
@@ -51,7 +51,7 @@ export declare class Collection<T extends Model = Model> extends EventEmitterObj
51
51
  set browserStorage(s: PersistentStorage);
52
52
  /**
53
53
  * Override to return `true` to automatically load the collection from
54
- * storage on construction. Await `initialized` to know when hydration
54
+ * storage on construction. Await `hydrated` to know when hydration
55
55
  * is complete.
56
56
  *
57
57
  * Note: collection `autoSync` is hydrate-only. Unlike `Model`, it does
@@ -545,7 +545,7 @@ export declare class Model<T extends ModelAttributes = ModelAttributes> extends
545
545
  cid: string;
546
546
  collection?: Collection;
547
547
  id: string | number;
548
- initialized?: Promise<void>;
548
+ hydrated?: Promise<void>;
549
549
  validationError: string | number | null;
550
550
  /**
551
551
  * Create a new model with the specified attributes. A client id (`cid`)
@@ -860,10 +860,16 @@ export declare interface StorageDriver {
860
860
  length(): Promise<number>;
861
861
  key(keyIndex: number): Promise<string | null>;
862
862
  keys(): Promise<string[]>;
863
- setItems?(items: Record<string, any>): Promise<void>;
863
+ /**
864
+ * Write several items in one go. A successful write is signalled by the
865
+ * promise settling, not by what it resolves with: drivers may resolve with
866
+ * the written items (localForage does) or with nothing, and callers must
867
+ * treat both as success.
868
+ */
869
+ setItems?(items: Record<string, any>): Promise<Record<string, any> | void>;
864
870
  getItems?(keys: string[]): Promise<Record<string, any>>;
865
871
  debouncedSetItems?: {
866
- (items: Record<string, any>): Promise<void>;
872
+ (items: Record<string, any>): Promise<Record<string, any> | void>;
867
873
  flush?: () => void;
868
874
  };
869
875
  }