@taladb/react-native 0.6.0 → 0.7.3

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.
@@ -70,6 +70,7 @@ std::vector<PropNameID> TalaDBHostObject::getPropertyNames(Runtime &rt) {
70
70
  "count",
71
71
  "createIndex", "dropIndex",
72
72
  "createFtsIndex", "dropFtsIndex",
73
+ "compact",
73
74
  "close",
74
75
  };
75
76
  std::vector<PropNameID> result;
@@ -264,6 +265,19 @@ Value TalaDBHostObject::get(Runtime &rt, const PropNameID &propName) {
264
265
  });
265
266
  }
266
267
 
268
+ // ------------------------------------------------------------------
269
+ // compact(): void
270
+ // ------------------------------------------------------------------
271
+ if (name == "compact") {
272
+ return Function::createFromHostFunction(
273
+ rt, PropNameID::forAscii(rt, "compact"), 0,
274
+ [this](Runtime &rt, const Value &, const Value *, size_t) -> Value {
275
+ int32_t res = taladb_compact(db_);
276
+ if (res < 0) throw JSError(rt, "taladb_compact failed");
277
+ return Value::undefined();
278
+ });
279
+ }
280
+
267
281
  // ------------------------------------------------------------------
268
282
  // close(): void (synchronous — the destructor does the real work)
269
283
  // ------------------------------------------------------------------
package/cpp/taladb.h CHANGED
@@ -48,6 +48,12 @@ TalaDbHandle *taladb_open_with_config(const char *path, const char *config_json)
48
48
  /** Flush and close the database, freeing the handle. */
49
49
  void taladb_close(TalaDbHandle *handle);
50
50
 
51
+ /**
52
+ * Compact the underlying storage file, reclaiming space freed by deletes and
53
+ * updates. No-op on in-memory databases. Returns 1 on success, -1 on error.
54
+ */
55
+ int32_t taladb_compact(TalaDbHandle *handle);
56
+
51
57
  /** Free a C string returned by any taladb_* function. */
52
58
  void taladb_free_string(char *s);
53
59
 
@@ -6,38 +6,38 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>BinaryPath</key>
9
- <string>libtaladb_ffi.a</string>
9
+ <string>libtaladb_ffi_sim.a</string>
10
10
  <key>HeadersPath</key>
11
11
  <string>Headers</string>
12
12
  <key>LibraryIdentifier</key>
13
- <string>ios-arm64</string>
13
+ <string>ios-arm64_x86_64-simulator</string>
14
14
  <key>LibraryPath</key>
15
- <string>libtaladb_ffi.a</string>
15
+ <string>libtaladb_ffi_sim.a</string>
16
16
  <key>SupportedArchitectures</key>
17
17
  <array>
18
18
  <string>arm64</string>
19
+ <string>x86_64</string>
19
20
  </array>
20
21
  <key>SupportedPlatform</key>
21
22
  <string>ios</string>
23
+ <key>SupportedPlatformVariant</key>
24
+ <string>simulator</string>
22
25
  </dict>
23
26
  <dict>
24
27
  <key>BinaryPath</key>
25
- <string>libtaladb_ffi_sim.a</string>
28
+ <string>libtaladb_ffi.a</string>
26
29
  <key>HeadersPath</key>
27
30
  <string>Headers</string>
28
31
  <key>LibraryIdentifier</key>
29
- <string>ios-arm64_x86_64-simulator</string>
32
+ <string>ios-arm64</string>
30
33
  <key>LibraryPath</key>
31
- <string>libtaladb_ffi_sim.a</string>
34
+ <string>libtaladb_ffi.a</string>
32
35
  <key>SupportedArchitectures</key>
33
36
  <array>
34
37
  <string>arm64</string>
35
- <string>x86_64</string>
36
38
  </array>
37
39
  <key>SupportedPlatform</key>
38
40
  <string>ios</string>
39
- <key>SupportedPlatformVariant</key>
40
- <string>simulator</string>
41
41
  </dict>
42
42
  </array>
43
43
  <key>CFBundlePackageType</key>
@@ -70,6 +70,7 @@ std::vector<PropNameID> TalaDBHostObject::getPropertyNames(Runtime &rt) {
70
70
  "count",
71
71
  "createIndex", "dropIndex",
72
72
  "createFtsIndex", "dropFtsIndex",
73
+ "compact",
73
74
  "close",
74
75
  };
75
76
  std::vector<PropNameID> result;
@@ -264,6 +265,19 @@ Value TalaDBHostObject::get(Runtime &rt, const PropNameID &propName) {
264
265
  });
265
266
  }
266
267
 
268
+ // ------------------------------------------------------------------
269
+ // compact(): void
270
+ // ------------------------------------------------------------------
271
+ if (name == "compact") {
272
+ return Function::createFromHostFunction(
273
+ rt, PropNameID::forAscii(rt, "compact"), 0,
274
+ [this](Runtime &rt, const Value &, const Value *, size_t) -> Value {
275
+ int32_t res = taladb_compact(db_);
276
+ if (res < 0) throw JSError(rt, "taladb_compact failed");
277
+ return Value::undefined();
278
+ });
279
+ }
280
+
267
281
  // ------------------------------------------------------------------
268
282
  // close(): void (synchronous — the destructor does the real work)
269
283
  // ------------------------------------------------------------------
@@ -48,6 +48,12 @@ TalaDbHandle *taladb_open_with_config(const char *path, const char *config_json)
48
48
  /** Flush and close the database, freeing the handle. */
49
49
  void taladb_close(TalaDbHandle *handle);
50
50
 
51
+ /**
52
+ * Compact the underlying storage file, reclaiming space freed by deletes and
53
+ * updates. No-op on in-memory databases. Returns 1 on success, -1 on error.
54
+ */
55
+ int32_t taladb_compact(TalaDbHandle *handle);
56
+
51
57
  /** Free a C string returned by any taladb_* function. */
52
58
  void taladb_free_string(char *s);
53
59
 
@@ -70,6 +70,7 @@ std::vector<PropNameID> TalaDBHostObject::getPropertyNames(Runtime &rt) {
70
70
  "count",
71
71
  "createIndex", "dropIndex",
72
72
  "createFtsIndex", "dropFtsIndex",
73
+ "compact",
73
74
  "close",
74
75
  };
75
76
  std::vector<PropNameID> result;
@@ -264,6 +265,19 @@ Value TalaDBHostObject::get(Runtime &rt, const PropNameID &propName) {
264
265
  });
265
266
  }
266
267
 
268
+ // ------------------------------------------------------------------
269
+ // compact(): void
270
+ // ------------------------------------------------------------------
271
+ if (name == "compact") {
272
+ return Function::createFromHostFunction(
273
+ rt, PropNameID::forAscii(rt, "compact"), 0,
274
+ [this](Runtime &rt, const Value &, const Value *, size_t) -> Value {
275
+ int32_t res = taladb_compact(db_);
276
+ if (res < 0) throw JSError(rt, "taladb_compact failed");
277
+ return Value::undefined();
278
+ });
279
+ }
280
+
267
281
  // ------------------------------------------------------------------
268
282
  // close(): void (synchronous — the destructor does the real work)
269
283
  // ------------------------------------------------------------------
@@ -48,6 +48,12 @@ TalaDbHandle *taladb_open_with_config(const char *path, const char *config_json)
48
48
  /** Flush and close the database, freeing the handle. */
49
49
  void taladb_close(TalaDbHandle *handle);
50
50
 
51
+ /**
52
+ * Compact the underlying storage file, reclaiming space freed by deletes and
53
+ * updates. No-op on in-memory databases. Returns 1 on success, -1 on error.
54
+ */
55
+ int32_t taladb_compact(TalaDbHandle *handle);
56
+
51
57
  /** Free a C string returned by any taladb_* function. */
52
58
  void taladb_free_string(char *s);
53
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taladb/react-native",
3
- "version": "0.6.0",
3
+ "version": "0.7.3",
4
4
  "description": "TalaDB React Native module — document and vector database via JSI HostObject",
5
5
  "main": "src/index",
6
6
  "types": "src/index.tsx",