@converse/skeletor 3.1.5 → 3.1.6

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,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.1.6 (2026-08-06)
4
+
5
+ - The `'node'` store type can now be told where to put its database files, via the new
6
+ `PersistentStorage.nodeStorageDir`. The driver has always taken a `storageDir` argument,
7
+ but nothing could reach it through the string store type, so `new PersistentStorage(id, 'node')`
8
+ was stuck with the driver's default. That default is relative, so it resolves against
9
+ `process.cwd()` and an app started from two directories keeps two separate sets of state.
10
+ Set an absolute path (`$XDG_STATE_HOME/<app>`, say) to pin it. The default is unchanged.
11
+
12
+ - Ship a separate `dist/skeletor.node.d.ts` for the `@converse/skeletor/node` entry point.
13
+ Both entry points pointed their `types` at the browser rollup.
14
+
3
15
  ## 3.1.5 (2026-07-22)
4
16
 
5
17
  - Fix every write through the Node.js SQLite driver failing with `Record Not Found` while
@@ -762,8 +762,9 @@ export declare function noConflict(): any;
762
762
  /**
763
763
  * Constructor for a Node.js-only storage driver. Registered by the
764
764
  * `@converse/skeletor/node` entry point via {@link PersistentStorage.nodeStorage}.
765
+ * @public
765
766
  */
766
- declare type NodeStorageConstructor = new (name: string) => StorageDriver;
767
+ export declare type NodeStorageConstructor = new (name: string, storageDir?: string, inMemory?: boolean) => StorageDriver;
767
768
 
768
769
  /**
769
770
  * @public
@@ -795,6 +796,18 @@ export declare class PersistentStorage {
795
796
  static sessionStorageInitialized: Promise<void>;
796
797
  static localForage: typeof localForage;
797
798
  static nodeStorage: NodeStorageConstructor | null;
799
+ /**
800
+ * Directory the `'node'` store type writes its database files to. The driver's
801
+ * own default is relative, so it resolves against `process.cwd()` and a process
802
+ * started from two directories ends up with two separate sets of state. Set an
803
+ * absolute path (`$XDG_STATE_HOME/<app>`, say) to pin it. Left `null`, the
804
+ * driver's default applies.
805
+ *
806
+ * Only the `'node'` string store type reads this; passing a driver instance to
807
+ * the constructor means you've already chosen a directory yourself.
808
+ * @public
809
+ */
810
+ static nodeStorageDir: string | null;
798
811
  /** Register a storage instance with a weak reference. @public */
799
812
  static register(instance: PersistentStorage): void;
800
813
  /**
@@ -8699,7 +8699,7 @@ class PersistentStorage {
8699
8699
  throw new Error("Skeletor.storage: the 'node' storage type is only available in Node.js builds. " +
8700
8700
  "Import from '@converse/skeletor/node' instead of '@converse/skeletor'.");
8701
8701
  }
8702
- this.store = new NodeSQLiteStorage(this.name);
8702
+ this.store = new NodeSQLiteStorage(this.name, PersistentStorage.nodeStorageDir ?? undefined);
8703
8703
  if (batchedWrites) {
8704
8704
  this.store.debouncedSetItems = mergebounce((items) => this.store.setItems(items), 50, {
8705
8705
  'promise': true,
@@ -8903,6 +8903,18 @@ class PersistentStorage {
8903
8903
  // node-only driver (and its `node:sqlite` import) never enters the browser
8904
8904
  // bundle; the `@converse/skeletor/node` entry sets it.
8905
8905
  PersistentStorage.nodeStorage = null;
8906
+ /**
8907
+ * Directory the `'node'` store type writes its database files to. The driver's
8908
+ * own default is relative, so it resolves against `process.cwd()` and a process
8909
+ * started from two directories ends up with two separate sets of state. Set an
8910
+ * absolute path (`$XDG_STATE_HOME/<app>`, say) to pin it. Left `null`, the
8911
+ * driver's default applies.
8912
+ *
8913
+ * Only the `'node'` string store type reads this; passing a driver instance to
8914
+ * the constructor means you've already chosen a directory yourself.
8915
+ * @public
8916
+ */
8917
+ PersistentStorage.nodeStorageDir = null;
8906
8918
  PersistentStorage.sessionStorageInitialized = localForage.defineDriver(sessionStorageWrapper);
8907
8919
  PersistentStorage.localForage = localForage;
8908
8920