@op-engineering/op-sqlite 5.0.5 → 5.0.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/README.md CHANGED
@@ -1,11 +1,5 @@
1
1
  ![benchmark](benchmark.png)
2
2
 
3
- ```sh
4
- yarn add @op-engineering/op-sqlite && npx pod-install
5
- ```
6
-
7
- OP-SQLite embeds the latest version of SQLite and provides a low-level API to execute SQL queries.
8
-
9
3
  **Current SQLite version: 3.45.1**
10
4
 
11
5
  Created by [@ospfranco](https://twitter.com/ospfranco). **Please consider sponsoring!**.
@@ -14,10 +8,6 @@ Created by [@ospfranco](https://twitter.com/ospfranco). **Please consider sponso
14
8
 
15
9
  [See the docs](https://ospfranco.notion.site/OP-SQLite-Documentation-a279a52102464d0cb13c3fa230d2f2dc?pvs=4)
16
10
 
17
- # Contribute
18
-
19
- You need to have clang-format installed (`brew install clang-format`)
20
-
21
11
  # License
22
12
 
23
13
  MIT License.
@@ -15,7 +15,7 @@ namespace jsi = facebook::jsi;
15
15
 
16
16
  class JSI_EXPORT DumbHostObject : public jsi::HostObject {
17
17
  public:
18
- DumbHostObject(){};
18
+ DumbHostObject() {};
19
19
 
20
20
  DumbHostObject(std::shared_ptr<std::vector<SmartHostObject>> metadata);
21
21
 
@@ -12,7 +12,7 @@ namespace jsi = facebook::jsi;
12
12
 
13
13
  class JSI_EXPORT SmartHostObject : public jsi::HostObject {
14
14
  public:
15
- SmartHostObject(){};
15
+ SmartHostObject() {};
16
16
 
17
17
  std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt);
18
18
 
package/cpp/bindings.cpp CHANGED
@@ -199,7 +199,7 @@ void install(jsi::Runtime &rt,
199
199
 
200
200
  std::string dbName = args[0].asString(rt).utf8(rt);
201
201
 
202
- std::string tempDocPath = std::string(basePath);
202
+ std::string path = std::string(basePath);
203
203
 
204
204
  if (count > 1 && !args[1].isUndefined() && !args[1].isNull()) {
205
205
  if (!args[1].isString()) {
@@ -207,10 +207,20 @@ void install(jsi::Runtime &rt,
207
207
  "[op-sqlite][open] database location must be a string");
208
208
  }
209
209
 
210
- tempDocPath = tempDocPath + "/" + args[1].asString(rt).utf8(rt);
210
+ std::string location = args[1].asString(rt).utf8(rt);
211
+
212
+ if (!location.empty()) {
213
+ if (location == ":memory:") {
214
+ path = ":memory:";
215
+ } else if (location.rfind("/", 0) == 0) {
216
+ path = location;
217
+ } else {
218
+ path = path + "/" + location;
219
+ }
220
+ }
211
221
  }
212
222
 
213
- BridgeResult result = opsqlite_remove(dbName, tempDocPath);
223
+ BridgeResult result = opsqlite_remove(dbName, path);
214
224
 
215
225
  if (result.type == SQLiteError) {
216
226
  throw std::runtime_error(result.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@op-engineering/op-sqlite",
3
- "version": "5.0.5",
3
+ "version": "5.0.6",
4
4
  "description": "Next generation SQLite for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -29,7 +29,8 @@
29
29
  "example": "yarn --cwd example",
30
30
  "pods": "cd example && yarn pods",
31
31
  "bootstrap": "yarn example && yarn && yarn pods",
32
- "release": "./bump-version.sh && git add . && git commit -m 'Release v$(node -p \"require('./package.json').version\")' && git tag v$(node -p \"require('./package.json').version\") && git push origin main --tags && npm publish"
32
+ "release": "./bump-version.sh && git add . && git commit -m 'Release v$(node -p \"require('./package.json').version\")' && git tag v$(node -p \"require('./package.json').version\") && git push origin main --tags && npm publish",
33
+ "clang-format-check": "clang-format -i cpp/*.cpp cpp/*.h"
33
34
  },
34
35
  "keywords": [
35
36
  "react-native",
@@ -47,16 +48,17 @@
47
48
  "registry": "https://registry.npmjs.org/"
48
49
  },
49
50
  "devDependencies": {
51
+ "clang-format": "^1.8.0",
50
52
  "lefthook": "^1.5.5",
51
53
  "react": "18.2.0",
52
- "react-native": "0.74.0-rc.6",
54
+ "react-native": "0.74.0",
53
55
  "react-native-builder-bob": "^0.23.2",
54
56
  "turbo": "^1.12.4",
55
57
  "typescript": "5.0.4"
56
58
  },
57
59
  "peerDependencies": {
58
60
  "react": "*",
59
- "react-native": "*"
61
+ "react-native": ">0.73.0"
60
62
  },
61
63
  "workspaces": [
62
64
  "example"