sekejap 0.19.0 → 0.19.2

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/index.js CHANGED
@@ -103,6 +103,7 @@ const fn = {
103
103
  sekejap_open_service: lib.func('SekejapDb *sekejap_open_service(const char *path)'),
104
104
  sekejap_close: lib.func('void sekejap_close(SekejapDb *db)'),
105
105
  sekejap_version: lib.func('const char *sekejap_version(void)'), // NOT HeapStr: static
106
+ sekejap_upgrade: lib.func('HeapStr sekejap_upgrade(const char *path)'),
106
107
  sekejap_format_version: lib.func('int32_t sekejap_format_version(void)'),
107
108
 
108
109
  // 4.2 Errors and memory
@@ -818,6 +819,20 @@ function version() {
818
819
  return fn.sekejap_version();
819
820
  }
820
821
 
822
+ /**
823
+ * Move a database a 0.18 release wrote to the 0.19 format, once, before
824
+ * opening it; 0.19 opens no 0.18 file until then. Safe on every start: a 0.19
825
+ * file or a missing path is left alone and `null` returned. When it moves one,
826
+ * the untouched 0.18 original is kept and its path returned. Nothing may have
827
+ * the database open meanwhile.
828
+ */
829
+ function upgrade(path) {
830
+ const text = fn.sekejap_upgrade(path);
831
+ if (text === null) throw lastError(null);
832
+ const moved = JSON.parse(text);
833
+ return moved.moved ? moved.backup : null;
834
+ }
835
+
821
836
  /** The sekejap disk format this build reads and writes. */
822
837
  function formatVersion() {
823
838
  return fn.sekejap_format_version();
@@ -832,5 +847,6 @@ module.exports = {
832
847
  SekejapStatus,
833
848
  SekejapDirection,
834
849
  version,
850
+ upgrade,
835
851
  formatVersion,
836
852
  };
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sekejap",
3
- "version": "0.19.0",
3
+ "version": "0.19.2",
4
4
  "description": "Embedded graph-first multi-model database — Node.js binding over the C ABI (libsekejap)",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "repository": "github:sekejapdb/sekejap",